コード例 #1
0
        public IHttpActionResult Delete(int id)
        {
            ExtendModule.TableDelete(id);
            GgcmsModules module = Dbctx.GgcmsModules.Where(x => x.Id == id).FirstOrDefault();

            if (module != null)
            {
                Dbctx.GgcmsModules.Remove(module);
                Dbctx.SaveChanges();
            }
            ClearCache();
            return(Ok(id));
        }
コード例 #2
0
 public IHttpActionResult MultDelete(int[] ids)
 {
     try
     {
         var query = Dbctx.GgcmsModules.Where(x => ids.Contains(x.Id));
         foreach (var item in query.ToList())
         {
             GgcmsModules module = item as GgcmsModules;
             ExtendModule.TableDelete(module.Id);
         }
         Dbctx.GgcmsModules.RemoveRange(query);
         int c = Dbctx.SaveChanges();
         ClearCache();
         return(Ok(c));
     } catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }