Ejemplo n.º 1
0
        public ActionResult Create(int menuId, int companyId, CreateMenuItemViewModel createMenuItemViewModel)
        {
            if (ModelState.IsValid)
            {
                var menuProduct = new MenuProduct();
                PopulateMenu(createMenuItemViewModel, menuProduct);

                int productId = MenuService.AddProduct(menuProduct);

                MenuService.AddMenuMapping(new MenuProductsMap
                {
                    MenuId        = menuId,
                    MenuProductId = productId
                });
                return(RedirectToAction("Details", "Company", new { id = companyId }));
            }

            ViewBag.MenuId = menuId;

            PopulateSelectLists(createMenuItemViewModel);

            return(View(createMenuItemViewModel));
        }