public bool Delete(long id)
 {
     try
     {
         var doc = new DocumentDao().ListAll(id);
         foreach (var item in doc)
         {
             new DocumentDao().Delete(item.ID);
         }
         var cate = db.DocumentCategories.Find(id);
         db.DocumentCategories.Remove(cate);
         db.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Example #2
0
 public int Insert(Feedback entity)
 {
     db.Feedbacks.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
Example #3
0
 public long Insert(User entity)
 {
     db.Users.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }
Example #4
0
 public long Insert(Document entity)
 {
     db.Documents.Add(entity);
     db.SaveChanges();
     return(entity.ID);
 }