public ActionResult <ItemResponse> CreateItem(ItemEditRequest request)
        {
            var result   = _itemsService.Create(request);
            var response = result.ToApiModel();

            return(response);
        }
예제 #2
0
        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));
            }
        }
예제 #3
0
        public ActionResult <Item> Create(Item item)
        {
            _itemsService.Create(item);

            return(CreatedAtRoute("GetItem", new { id = item.PID.ToString() }, item));
        }