예제 #1
0
        public async Task <ActionResult <Dictionary <string, Dictionary <string, string> > > > GetAsync()
        {
            var inventoryItems = _services.GetInventoryItemsAsync();

            if (inventoryItems == null)
            {
                return(NotFound());
            }

            Task <List <InventoryItems> > inventoryItems1 = inventoryItems;

            var items = await inventoryItems1;

            Dictionary <string, Dictionary <string, string> > json = new Dictionary <string, Dictionary <string, string> >();

            foreach (var item in items)
            {
                json.Add(item.Id.ToString(), new Dictionary <string, string>()
                {
                    { "version", item.Version.ToString() },
                    { "createdDate", item.Creation_Date.ToString() },
                    { "startDate", item.Start_Date.ToString() },
                    { "endDate", item.End_Date.ToString() },
                    { "displayName", item.Display_Name.ToString() },
                    { "description", item.Description.ToString() },
                    { "catalogRefId", item.Catalog_Ref_Id.ToString() },
                    { "availabilityStatus", item.Availability_Status.ToString() },
                    { "availabilityDate", item.Availability_Date.ToString() },
                    { "stockLevel", item.Stock_Level.ToString() },
                    { "stockThresh", item.Stock_Thresh.ToString() },
                    { "productId", item.Product_Id.ToString() },
                    { "createdBy", item.Created_By.ToString() }
                });
            }

            return(json);
        }