public async Task <ActionResult <V1DTO.ItemType> > PostItemType(V1DTO.ItemType itemType) { var bllEntity = _mapper.Map(itemType); _bll.ItemTypes.Add(bllEntity); await _bll.SaveChangesAsync(); itemType.Id = bllEntity.Id; return(CreatedAtAction("GetItemType", new { id = itemType.Id, version = HttpContext.GetRequestedApiVersion()?.ToString() ?? "0" }, itemType)); }
public async Task <IActionResult> PutItemType(Guid id, V1DTO.ItemType itemType) { if (id != itemType.Id) { return(BadRequest(new V1DTO.MessageDTO("Id and ItemType.Id do not match"))); } await _bll.ItemTypes.UpdateAsync(_mapper.Map(itemType)); await _bll.SaveChangesAsync(); return(NoContent()); }