public async Task<bool> Update(VehicleHeadType item) { var ht = await IdExist(item.Id); ht.Name = item.Name; _db.Entry(ht).State = EntityState.Modified; try { await _db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException exception) { throw new DbUpdateConcurrencyException(exception.Message); } return true; }
public async Task<VehicleHeadType> Add(VehicleHeadType item) { var ht = new VehicleHeadType { Name = item.Name, }; ht = _db.VehicleHeadTypes.Add(ht); try { await _db.SaveChangesAsync(); return ht; } catch (DbUpdateConcurrencyException exception) { throw new DbUpdateConcurrencyException(exception.Message); } }