public async Task <IActionResult> AddItem(ItemForInsertDto forInsert) { try { var objInsert = _mapper.Map <Item>(forInsert); _repo.Add(objInsert); if (await _repo.SaveAll()) { return(NoContent()); } return(StatusCode(201)); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> UpdateItem(int ItemId, ItemForInsertDto forUpdate) { try { var row = await _repo.GetItemByItemId(ItemId); _mapper.Map(forUpdate, row); if (await _repo.SaveAll()) { return(NoContent()); } return(StatusCode(201)); } catch (Exception ex) { throw ex; } }