Exemplo n.º 1
0
        public async Task <IActionResult> CheckOutFoodStock()
        {
            var getFoodDetails = await mediator.Send(new GetFoodStockDetailsQuery());

            List <SelectListItem> _list = new List <SelectListItem>();

            foreach (var item in getFoodDetails)
            {
                _list.Add(new SelectListItem
                {
                    Value = item.ID.ToString(),
                    Text  = item.FoodDetailsVM.Code + " | " + item.FoodDetailsVM.Name + " | Quantity: " + item.Quantity
                });
            }

            _list.Add(new SelectListItem {
                Text = "Add New Food", Value = "Add New Food"
            });

            FoodInventoryCVM FoodDetailsListVM = new FoodInventoryCVM
            {
                FoodStockDetailsList = _list,
            };

            return(View(FoodDetailsListVM));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> CheckOutFoodStock(FoodInventoryCVM foodInventoryVM)
        {
            FoodInventoryVM _updateFoodStock = new FoodInventoryVM
            {
                FoodDetailsID = foodInventoryVM.FoodDetailsID,
                Quantity      = foodInventoryVM.Quantity
            };

            var response = await mediator.Send(new CheckOutFoodStockCommand
            {
                MyFoodInventoryVM = _updateFoodStock
            });

            return(Json(response));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> AddFoodInventory()
        {
            var getFoodDetails = await mediator.Send(new GetFoodDetailsQuery());

            List <SelectListItem> _list = new List <SelectListItem>();

            foreach (var item in getFoodDetails)
            {
                _list.Add(new SelectListItem
                {
                    Value = item.ID.ToString(),
                    Text  = item.Code + " | " + item.Name + " | " + item.Description
                });
            }

            _list.Add(new SelectListItem {
                Text = "Add New Food", Value = "Add New Food"
            });
            var getFoodRestock = await mediator.Send(new GetFoodDeliveryQuery());

            List <SelectListItem> _list2 = new List <SelectListItem>();

            foreach (var item in getFoodRestock)
            {
                _list2.Add(new SelectListItem
                {
                    Value = item.ID.ToString(),
                    Text  = "Delivery ID: " + item.ID + " | Delivery Date: " + item.DeliveryDate.ToString("MMM dd, yyyy")
                });
            }
            _list2.Add(new SelectListItem {
                Text = "Add New Delivery", Value = "Add New Delivery"
            });

            FoodInventoryCVM FoodDetailsListVM = new FoodInventoryCVM
            {
                FoodDetailsList  = _list,
                FoodDeliveryList = _list2
            };

            return(View(FoodDetailsListVM));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> AddFoodInventory(FoodInventoryCVM foodInventoryVM)
        {
            FoodInventoryVM _foodInventory = new FoodInventoryVM
            {
                FoodDetailsID     = foodInventoryVM.FoodDetailsID,
                DeliveryDetailsID = foodInventoryVM.DeliveryDetailsID,
                UserID            = CurrentUser.ID,
                ItemPrice         = foodInventoryVM.ItemPrice,
                Quantity          = foodInventoryVM.Quantity,
                ExpirationDate    = foodInventoryVM.ExpirationDate,
                Remarks           = foodInventoryVM.Remarks
            };

            var response = await mediator.Send(new AddFoodInventoryCommand
            {
                MyFoodInventoryVM = _foodInventory
            });

            return(Json(response));
        }