public ActionResult ChooseRolePartial(string username) { var helper = new UserRolesHelper(); //ApplicationDbContext UserDb = new ApplicationDbContext(); var ListOfRoles = db.Roles.OrderBy(r => r.Name).ToList().Select(rr => rr.Name.ToString()).ToList(); var userRoles = helper.ListUserRoles(username); var roles = ListOfRoles.Select(x => new SelectListItem { Value = x, Text = x, Selected = userRoles.Contains(x) }).ToArray(); var model = new ChooseRoleModel { Roles = roles, Username = username }; return(PartialView("Partials/ChooseRolePartial", model)); }
public ActionResult ChooseRolePartial(ChooseRoleModel model) { var testReturnValue = model; return(View("Index")); }