public bool Delete(Guid ID) { InputData_DTO.ProjectModels.Category cate = _context.Categories.SingleOrDefault(admin => admin.ID == ID); _context.Categories.DefaultIfEmpty(cate); _context.Entry(cate).State = System.Data.Entity.EntityState.Deleted; return(_context.SaveChanges() == 1); }
public bool Update(InputData_DTO.ProjectModels.Category cate) { _context.Categories.Attach(cate); _context.Entry(cate).State = System.Data.Entity.EntityState.Modified; return(_context.SaveChanges() == 1); }