public bool Edit(Items item) { try { //Items OldItem = ctx.Items.Where(a => a.ItemId == item.ItemId).FirstOrDefault(); //OldItem.CategoryId = item.CategoryId; ctx.Entry(item).State = EntityState.Modified; ctx.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public async Task UpdateAsync(T entity) { _dbContext.Entry(entity).State = EntityState.Modified; await _dbContext.SaveChangeAsync(); }