示例#1
0
        public async Task <ActionResult <ItemTextView> > PostItemText(int itemId, [FromBody] ItemTextView itemTextView)
        {
            try
            {
                itemTextView.ItemId = itemId;

                if (ModelState.IsValid)
                {
                    var createdeItemTextView = await _itemRepository.AddItemTextView(itemTextView);

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