public async Task <IActionResult> PutItemOption(Guid id, V1DTO.ItemOption itemOption) { if (id != itemOption.Id) { return(BadRequest(new V1DTO.MessageDTO("Id and ItemOption.Id do not match"))); } await _bll.ItemOptions.UpdateAsync(_mapper.Map(itemOption)); await _bll.SaveChangesAsync(); return(NoContent()); }
public async Task <ActionResult <V1DTO.ItemOption> > PostItemOption(V1DTO.ItemOption itemOption) { var bllEntity = _mapper.Map(itemOption); _bll.ItemOptions.Add(bllEntity); await _bll.SaveChangesAsync(); itemOption.Id = bllEntity.Id; return(CreatedAtAction("GetItemOption", new { id = itemOption.Id, version = HttpContext.GetRequestedApiVersion()?.ToString() ?? "0" }, itemOption)); }