Ejemplo n.º 1
0
        public async Task <ActionResult <ItemDataView> > PostItemData(int itemId, [FromBody] ItemDataView itemDataView)
        {
            try
            {
                itemDataView.ItemId = itemId;

                if (ModelState.IsValid)
                {
                    var createdeItemDataView = await _itemRepository.AddItemDataView(itemDataView);

                    return(CreatedAtAction("Get", new { id = createdeItemDataView.ItemId }, createdeItemDataView));
                }
                else
                {
                    return(BadRequest(ModelState));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest("Failed to save the ItemData: " + ex.Message));
            }
        }