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("@OId", Id) }; SuClassificationPageSectionEditGetModel ClassificationPageSectionEditGet = _context.ZdbClassificationPageSectionEditGet.FromSql("ClassificationPageSectionEditGet @LanguageId, @OId", parameters).First(); var ContentTypeList = new List <SelectListItem>(); var parameter = new SqlParameter("@LanguageId", CurrentUser.DefaultLanguageId); var ContentTypesFromDb = _context.ZDbTypeList.FromSql("ContentTypeSelectAllForLanguage @LanguageId", parameter).ToList(); foreach (var ContentTypeFromDb in ContentTypesFromDb) { ContentTypeList.Add(new SelectListItem { Text = ContentTypeFromDb.Name, Value = ContentTypeFromDb.Id.ToString() }); } var PageSectionTypeList = new List <SelectListItem>(); var PageSectionTypesFromDb = _context.ZDbStatusList.FromSql("PageSectionTypeSelectAllForLanguage @LanguageId", parameter).ToList(); foreach (var PageSectionTypeFromDb in PageSectionTypesFromDb) { PageSectionTypeList.Add(new SelectListItem { Text = PageSectionTypeFromDb.Name, Value = PageSectionTypeFromDb.Id.ToString() }); } SuClassificationPageSectionEditGetWithListModel ClassificationPageSectionWithList = new SuClassificationPageSectionEditGetWithListModel { ClassificationPageSection = ClassificationPageSectionEditGet , ContentTypeList = ContentTypeList , SectionTypeList = PageSectionTypeList }; return(View(ClassificationPageSectionWithList)); }
public async Task <IActionResult> Create(SuClassificationPageSectionEditGetWithListModel FromForm) { var CurrentUser = await _userManager.GetUserAsync(User); SqlParameter[] parameters = { new SqlParameter("@PId", FromForm.ClassificationPageSection.PId) , new SqlParameter("@LanguageId", CurrentUser.DefaultLanguageId) , new SqlParameter("@Sequence", FromForm.ClassificationPageSection.Sequence) , new SqlParameter("@SectionTypeId", FromForm.ClassificationPageSection.SectionTypeId) , new SqlParameter("@ShowSectionTitleName", FromForm.ClassificationPageSection.ShowSectionTitleName) , new SqlParameter("@ShowSectionTitleDescription", FromForm.ClassificationPageSection.ShowSectionTitleDescription) , new SqlParameter("@ShowContentTypeTitleName", FromForm.ClassificationPageSection.ShowContentTypeTitleName) , new SqlParameter("@ShowContentTypeTitleDescription", FromForm.ClassificationPageSection.ShowContentTypeTitleDescription) , new SqlParameter("@OneTwoColumns", FromForm.ClassificationPageSection.OneTwoColumns) , new SqlParameter("@ContentTypeId", FromForm.ClassificationPageSection.ContentTypeId) , new SqlParameter("@SortById", FromForm.ClassificationPageSection.SortById) , new SqlParameter("@MaxContent", FromForm.ClassificationPageSection.MaxContent) , new SqlParameter("@HasPaging", FromForm.ClassificationPageSection.HasPaging) , new SqlParameter("@ModifierId", CurrentUser.Id) , new SqlParameter("@Name", FromForm.ClassificationPageSection.Name) , new SqlParameter("@Description", FromForm.ClassificationPageSection.Description) , new SqlParameter("@MouseOver", FromForm.ClassificationPageSection.MouseOver) , new SqlParameter("@MenuName", FromForm.ClassificationPageSection.MenuName) , new SqlParameter("@TitleName", FromForm.ClassificationPageSection.TitleName) , new SqlParameter("@TitleDescription", FromForm.ClassificationPageSection.TitleDescription) }; _context.Database.ExecuteSqlCommand("ClassificationPageSectionCreatePost " + "@PId" + ", @LanguageId" + ", @Sequence" + ", @SectionTypeId" + ", @ShowSectionTitleName" + ", @ShowSectionTitleDescription" + ", @ShowContentTypeTitleName" + ", @ShowContentTypeTitleDescription" + ", @OneTwoColumns" + ", @ContentTypeId" + ", @SortById" + ", @MaxContent" + ", @HasPaging" + ", @ModifierId" + ", @Name" + ", @Description" + ", @MouseOver" + ", @MenuName" + ", @TitleName" + ", @TitleDescription", parameters); return(RedirectToAction("Index", new { Id = FromForm.ClassificationPageSection.PId.ToString() })); }