Beispiel #1
0
        public async Task <ActionResult <ItemDataView> > PostItemAttribute(int itemId, [FromBody] ItemAttributeView itemAttributeView)
        {
            try
            {
                itemAttributeView.ItemId = itemId;

                if (ModelState.IsValid)
                {
                    var createdeItemAttributeView = await _itemRepository.AddItemAttributeView(itemAttributeView);

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