public IActionResult FoodGet(int id)
        {
            var x = foodRepository.GetT(id);
            List <SelectListItem> values = (from a in c.Categories.ToList()
                                            select new SelectListItem
            {
                Text = a.CategoryName,
                Value = a.CategoryId.ToString()
            }).ToList();

            ViewBag.v1 = values;


            Food f = new Food()
            {
                FoodId      = x.FoodId,
                CategoryId  = x.CategoryId,
                Name        = x.Name,
                Price       = x.Price,
                Stock       = x.Stock,
                ImageURL    = x.ImageURL,
                Description = x.Description,
            };

            return(View(f));
        }
Пример #2
0
        public IActionResult FoodGet(int id)
        {
            var x = foodRepository.GetT(id);
            List <SelectListItem> values = (from a in c.Categories.ToList() select new SelectListItem {
                Text = a.CatgoryName, Value = a.CatgoryID.ToString()
            }).ToList();

            ViewBag.vls = values;
            Food fd = new Food()
            {
                Name        = x.Name,
                Description = x.Description,
                Price       = x.Price,
                Stock       = x.Stock,
                CategoryID  = x.CategoryID,
                ImageUrl    = x.ImageUrl,
                FoodID      = x.FoodID
            };

            return(View(fd));
        }