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("@OId", Id); AvailableObjectLanguages AvailableLanguages = new AvailableObjectLanguages(_context); var SuLanguage = AvailableLanguages.ReturnFreeLanguages(this.ControllerContext.RouteData.Values["controller"].ToString(), parameter); Int32 NoOfLanguages = SuLanguage.Count(); if (NoOfLanguages == 0) { return(RedirectToAction("LanguageIndex", new { Id })); } SuUserRelationTypeLanguageCreateGetModel UserRelationType = new SuUserRelationTypeLanguageCreateGetModel { OId = Id }; ViewBag.Id = Id.ToString(); var UserRelationTypeAndLanguages = new SuUserRelationTypeLanguageCreateGetWithListModel { UserRelationType = UserRelationType , LanguageList = SuLanguage }; return(View(UserRelationTypeAndLanguages)); }
public async Task <IActionResult> LanguageCreate(SuUserRelationTypeLanguageCreateGetWithListModel FromForm) { if (ModelState.IsValid) { var CurrentUser = await _userManager.GetUserAsync(User); SqlParameter[] parameters = { new SqlParameter("@OId", FromForm.UserRelationType.OId), new SqlParameter("@LanguageId", FromForm.UserRelationType.LanguageId), new SqlParameter("@FromIsOfToName", FromForm.UserRelationType.FromIsOfToName), new SqlParameter("@ToIsOfFromName", FromForm.UserRelationType.ToIsOfFromName), new SqlParameter("@FromIsOfToDescription", FromForm.UserRelationType.FromIsOfToDescription), new SqlParameter("@ToIsOfFromDescription", FromForm.UserRelationType.ToIsOfFromDescription), new SqlParameter("@FromIsOfToMouseOver", FromForm.UserRelationType.FromIsOfToMouseOver), new SqlParameter("@ToIsOfFromMouseOver", FromForm.UserRelationType.ToIsOfFromMouseOver), new SqlParameter("@FromIsOfToMenuName", FromForm.UserRelationType.FromIsOfToMenuName), new SqlParameter("@ToIsOfFromMenuName", FromForm.UserRelationType.ToIsOfFromMenuName), new SqlParameter("@ModifierId", CurrentUser.Id) }; _context.Database.ExecuteSqlCommand("UserRelationTypeLanguageCreatePost " + "@OId" + ", @LanguageId" + ", @FromIsOfToName" + ", @ToIsOfFromName" + ", @FromIsOfToDescription" + ", @ToIsOfFromDescription" + ", @FromIsOfToMouseOver" + ", @ToIsOfFromMouseOver" + ", @FromIsOfToMenuName" + ", @ToIsOfFromMenuName" + ", @ModifierId", parameters); } return(RedirectToAction("LanguageIndex", new { Id = FromForm.UserRelationType.OId.ToString() })); }