// GET: AccountManager/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(RedirectToAction("Index")); } // Attempt to fetch the matching object var o = m.GetUserById(id); if (o == null) { return(HttpNotFound()); } else { // Create a form var form = new ApplicationUserEditForm(); form = Mapper.Map <ApplicationUserEditForm>(o); // Configure its properties // Alternatively, could create a mapper etc. var roles = new List <string> { "Admin", "Student", "Faculty" }; // Configure the select list form.RoleList = new MultiSelectList(items: roles, selectedValues: o.Roles.ToList()); return(View(form)); } }
// GET: AccountManager/Edit/5 public ActionResult Edit(string id) { if (id == null) { return RedirectToAction("Index"); } // Attempt to fetch the matching object var o = m.GetUserById(id); if (o == null) { return HttpNotFound(); } else { // Create a form var form = new ApplicationUserEditForm(); form = Mapper.Map<ApplicationUserEditForm>(o); // Configure its properties // Alternatively, could create a mapper etc. var roles = new List<string> { "Admin", "Student", "Faculty" }; // Configure the select list form.RoleList = new MultiSelectList(items: roles, selectedValues: o.Roles.ToList()); return View(form); } }