關鍵字讀取api範例
// GET: api/Todo [HttpGet] public IEnumerableGet(string name, bool? enable, DateTime? insertTime) { var result = from a in _todoContext.Todos select a; if (name != null) { result = result.Where(a => a.Name.IndexOf(name) > -1); } if (enable != null) { result = from a in result where a.Enable == enable select a; } if (insertTime != null) { result = from a in result where a.InsertTime.Date == insertTime select a; } return result; }
範例下載:下載
0 意見:
張貼留言