Esempio n. 1
0
 public JsonResult Remove([FromBody] IEnumerable <T> id)
 {
     try
     {
         ContextService <T> service = new ContextService <T>(dbSet, hostelContext);
         List <Expression <Func <T, bool> > > list = new List <Expression <Func <T, bool> > >();
         foreach (var item in id)
         {
             Expression <Func <T, bool> > right = d => d.GUID == item.GUID;
             list.Add(right);
         }
         service.RemoveEntity(list);
         return(Json(new { state = true, message = "" }));
     }
     catch
     {
         return(Json(new { state = false, message = "删除数据错误" }));
     }
 }