public ActionResult <ItemResponse> CreateItem(ItemEditRequest request) { var result = _itemsService.Create(request); var response = result.ToApiModel(); return(response); }
public IActionResult Register([FromBody] ItemDto itemDto) { // map dto to entity var item = _mapper.Map <Item>(itemDto); try { // save _itemService.Create(item); return(Ok(item)); } catch (AppException ex) { // return error message if there was an exception return(BadRequest(ex.Message)); } }
public ActionResult <Item> Create(Item item) { _itemsService.Create(item); return(CreatedAtRoute("GetItem", new { id = item.PID.ToString() }, item)); }