Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(SuContentTypeEditGetWithListModel FromForm)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            SqlParameter[] parameters =
            {
                new SqlParameter("@OId",               FromForm.ContentType.Id),
                new SqlParameter("@LId",               FromForm.ContentType.Lid),
                new SqlParameter("@Name",              FromForm.ContentType.Name ?? ""),
                new SqlParameter("@Description",       FromForm.ContentType.Description ?? ""),
                new SqlParameter("@MouseOver",         FromForm.ContentType.MouseOver ?? ""),
                new SqlParameter("@MenuName",          FromForm.ContentType.MenuName ?? ""),
                new SqlParameter("@ModifierId",        CurrentUser.Id),
                new SqlParameter("@SecurityLevel",     FromForm.ContentType.SecurityLevel),
                new SqlParameter("@ProcessTemplateId", FromForm.ContentType.ProcessTemplateId)
            };
            _context.Database.ExecuteSqlCommand("ContentTypeEditPost " +
                                                "@OId" +
                                                ", @LId" +
                                                ", @Name" +
                                                ", @Description" +
                                                ", @MouseOver" +
                                                ", @MenuName" +
                                                ", @ModifierId" +
                                                ", @SecurityLevel" +
                                                ", @ProcessTemplateId", parameters);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int Id)
        {
            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);

            SqlParameter[] parameters =
            {
                new SqlParameter("@LanguageId", CurrentUser.DefaultLanguageId)
                ,                               new SqlParameter("@Id", Id)
            };

            var ContentTypeEditGet = _context.ZdbContentTypeEditGet.FromSql("ContentTypeEditGet @LanguageId, @Id", parameters).First();

            var parameter = new SqlParameter("@LanguageId", CurrentUser.DefaultLanguageId);

            List <SuTypeList> SecurityLevelFromDb = await _context.ZDbTypeList.FromSql("select Id, Name from DbSecurityLevel ORDER BY Name").ToListAsync();

            List <SuStatusList> ProcessTemplateFromDb = await _context.ZDbStatusList.FromSql("ProcessTemplateList @LanguageId", parameter).ToListAsync();

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

            foreach (var SecurityItem in SecurityLevelFromDb)
            {
                SecurityLevelList.Add(new SelectListItem {
                    Value = SecurityItem.Id.ToString(), Text = SecurityItem.Name
                });
            }

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

            ProcessTemplateList.Add(new SelectListItem {
                Value = "0", Text = "No approval"
            });

            foreach (var ProcessTemplateItem in ProcessTemplateFromDb)
            {
                ProcessTemplateList.Add(new SelectListItem {
                    Value = ProcessTemplateItem.Id.ToString(), Text = ProcessTemplateItem.Name
                });
            }

            SuContentTypeEditGetWithListModel ContentTypeWithLists = new SuContentTypeEditGetWithListModel();

            ContentTypeWithLists.ContentType         = ContentTypeEditGet;
            ContentTypeWithLists.SecurityLevelList   = SecurityLevelList;
            ContentTypeWithLists.ProcessTemplateList = ProcessTemplateList;

            return(View(ContentTypeWithLists));
        }