Пример #1
0
        public async Task <IActionResult> Create(SuMenu1EditGetWithListModel FromForm)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);


            SqlParameter[] parameters =
            {
                new SqlParameter("@MenuTypeId",       FromForm.Menu1.MenuTypeId),
                new SqlParameter("@Sequence",         FromForm.Menu1.Sequence),
                new SqlParameter("@ClassificationId", FromForm.Menu1.ClassificationId),
                new SqlParameter("@FeatureId",        FromForm.Menu1.FeatureId),
                new SqlParameter("@Controller",       FromForm.Menu1.Controller),
                new SqlParameter("@Action",           FromForm.Menu1.Action),
                new SqlParameter("@DestinationId",    FromForm.Menu1.DestinationId),
                new SqlParameter("@LanguageId",       CurrentUser.DefaultLanguageId),
                new SqlParameter("@ModifierId",       CurrentUser.Id),
                new SqlParameter("@MenuName",         FromForm.Menu1.MenuName),
                new SqlParameter("@MouseOver",        FromForm.Menu1.MouseOver)
            };

            _context.Database.ExecuteSqlCommand("Menu1CreatePost " +
                                                "@MenuTypeId" +
                                                ", @Sequence" +
                                                ", @ClassificationId" +
                                                ", @FeatureId" +
                                                ", @Controller" +
                                                ", @Action" +
                                                ", @DestinationId" +
                                                ", @LanguageId" +
                                                ", @ModifierId" +
                                                ", @MenuName" +
                                                ", @MouseOver", parameters);
            return(RedirectToAction("Index"));
        }
Пример #2
0
        public async Task <IActionResult> Create()
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            var DefaultLanguageID = CurrentUser.DefaultLanguageId;

            var UICustomizationArray = new UICustomization(_context);

            ViewBag.Terms = await UICustomizationArray.UIArray(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), DefaultLanguageID);

            Menus a = new Menus(_context);

            ViewBag.menuItems = await a.TopMenu(DefaultLanguageID);


            var parameter       = new SqlParameter("@LanguageId", CurrentUser.DefaultLanguageId);
            var Classifications = _context.ZDbStatusList.FromSql("Menu123EditGetClassificationList @LanguageId", parameter).ToList();

            var ClassificationList = new List <SelectListItem>();

            foreach (var Classification in Classifications)
            {
                ClassificationList.Add(new SelectListItem
                {
                    Text  = Classification.Name,
                    Value = Classification.Id.ToString()
                });
            }

            var MenuTypes = _context.ZDbTypeList.FromSql("MenuTypeList").ToList();

            var MenuTypeList = new List <SelectListItem>();

            foreach (var MenuType in MenuTypes)
            {
                MenuTypeList.Add(new SelectListItem
                {
                    Text  = MenuType.Name,
                    Value = MenuType.Id.ToString()
                });
            }

            var Menu1AndList = new SuMenu1EditGetWithListModel {
                ClassificationList = ClassificationList, MenuTypeList = MenuTypeList
            };

            return(View(Menu1AndList));
        }