Beispiel #1
0
 /// <summary>
 /// 删除表单
 /// </summary>
 /// <param name="form"></param>
 /// <returns></returns>
 public int Delete(Model.Form form)
 {
     using (var db = new DataContext())
     {
         db.Remove(form);
         return(db.SaveChanges());
     }
 }
Beispiel #2
0
 /// <summary>
 /// 添加一个表单
 /// </summary>
 /// <param name="form">表单实体</param>
 /// <returns></returns>
 public int Add(Model.Form form)
 {
     using (var db = new DataContext())
     {
         db.Add(form);
         return(db.SaveChanges());
     }
 }
Beispiel #3
0
 /// <summary>
 /// 删除表单
 /// </summary>
 /// <param name="form">表单实体</param>
 /// <param name="appLibrary">应用程序库实体</param>
 /// <param name="delete">是否彻底删除 0不 1彻底删除</param>
 /// <returns></returns>
 public int Delete(Model.Form form, Model.AppLibrary appLibrary, int delete = 0)
 {
     using (var db = new DataContext())
     {
         if (null != form)
         {
             if (delete == 0)
             {
                 form.Status = 2;
                 db.Update(form);//只作删除标记,不物理删除
             }
             else
             {
                 db.Remove(form);//物理删除
             }
         }
         if (null != appLibrary)
         {
             db.Remove(appLibrary);
             new AppLibrary().ClearCache();
         }
         return(db.SaveChanges());
     }
 }