コード例 #1
0
        public ActionResult GetAllInventories()
        {
            _logger.LogInformation("Getting all inventory");
            List <data.models.ProductInventory> inventories     = _inventoryService.GetCurrentInventories();
            List <ProductInventoryModel>        inventoryModels = inventories.Select(inventory => new ProductInventoryModel {
                id             = inventory.id,
                Product        = ProductMapper.DataModelToViewModel(inventory.Product),
                quantityOnHand = inventory.quantityOnHand,
                idealQuantity  = inventory.idealQuantity
            }).OrderBy(inventory => inventory.Product.name).ToList();

            return(Ok(inventoryModels));
        }