Ejemplo n.º 1
0
        public IActionResult EditMenuRestaurant(MenuRestaurant model)
        {
            var menuRestaurant = _context.MenuRestaurant.FirstOrDefault(f => f.MenuRestaurantId == model.MenuRestaurantId);

            menuRestaurant.Name = model.Name;
            _context.SaveChanges();
            return(View());
        }
Ejemplo n.º 2
0
        public IActionResult CreateMenuRestaurant(MenuRestaurant model, int RestaurantId)
        {
            var            restaurant    = _context.Restaurant.FirstOrDefault(f => f.RestaurantId == RestaurantId);
            MenuRestaurant newRestaurant = new MenuRestaurant();

            newRestaurant.Name   = model.Name;
            newRestaurant.UserId = model.UserId;
            _context.MenuRestaurant.Add(newRestaurant);
            _context.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> CreateMenuRestaurant(int id = 0)
        {
            var user = await _userManager.GetUserAsync(User);

            ViewBag.MenuList = _context.MenuRestaurant.Where(w => w.UserId == user.Id).Select(s => new SelectListItem {
                Value = s.MenuRestaurantId.ToString(), Text = s.Name
            }).ToList();
            if (id > 0)
            {
                MenuRestaurant newMenu = new MenuRestaurant();
                newMenu.UserId       = user.Id;
                ViewBag.RestaurantId = id;
                return(View(newMenu));
            }
            return(View());
        }