コード例 #1
0
        public async Task <IActionResult> Post(InventoryEntry inventoryEntry)
        {
            bool created;

            try
            {
                created = await Task.FromResult(_inventoryRepository.AddToInventory(inventoryEntry));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }

            if (created)
            {
                return(CreatedAtAction(nameof(Post), new { StoreId = inventoryEntry.StoreId, Sku = inventoryEntry.SKU }, inventoryEntry));
            }

            return(StatusCode(409));
        }