public async Task <IActionResult> LanguageCreate(SuContentTypeLanguageEditGetWitLanguageListModel FromForm) { SuUserModel CurrentUser = await _userManager.GetUserAsync(User); SqlParameter[] parameters = { new SqlParameter("@OId", FromForm.ContentType.OId), new SqlParameter("@LanguageId", FromForm.ContentType.LanguageId), 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("@TitleName", FromForm.ContentType.TitleName ?? ""), new SqlParameter("@TitleDescription", FromForm.ContentType.TitleDesciption ?? ""), new SqlParameter("@ModifierId", CurrentUser.Id) }; _context.Database.ExecuteSqlCommand("ContentTypeLanguageCreatePost " + "@OId" + ", @LanguageId" + ", @Name" + ", @Description" + ", @MouseOver" + ", @MenuName" + ", @TitleName" + ", @TitleDescription" + ", @ModifierId", parameters); return(RedirectToAction("LanguageIndex", new { Id = FromForm.ContentType.OId.ToString() })); //if (ModelState.IsValid) //{ // var ContentTypeLanguage = new SuContentTypeLanguageModel // { // Name = test3.SuObject.Name, // Description = test3.SuObject.Description, // MouseOver = test3.SuObject.MouseOver, // ContentTypeId = test3.SuObject.ObjectId, // LanguageId = test3.SuObject.LanguageId // }; // _contentTypeLanguage.AddContentTypeLanguage(ContentTypeLanguage); //} //return RedirectToAction("LanguageIndex", new { Id = test3.SuObject.ObjectId.ToString() }); }
public async Task <IActionResult> LanguageCreate(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); var parameter = new SqlParameter("@Id", Id); var LanguageList = _context.ZdbLanguageCreateGetLanguageList.FromSql("ContentTypeLanguageCreateGetLanguageList @Id", parameter).ToList(); List <SelectListItem> LList = new List <SelectListItem>(); foreach (var Language in LanguageList) { LList.Add(new SelectListItem { Value = Language.Value, Text = Language.Text }); } if (LList.Count() == 0) { return(RedirectToAction("LanguageIndex", new { Id })); } SuContentTypeLanguageEditGetModel ContentType = new SuContentTypeLanguageEditGetModel { OId = Id }; ViewBag.Id = Id.ToString(); var ContentTypeAndStatus = new SuContentTypeLanguageEditGetWitLanguageListModel { ContentType = ContentType , LanguageList = LList }; return(View(ContentTypeAndStatus)); }