public ActionResult Edit(Microsoft.AspNet.Identity.EntityFramework.IdentityRole role, Asn2_GoodSam.Models.ApplicationDbContext context) { try { // TODO: Add update logic here context.Entry(role).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }
// Enable user by adding the hashed password of him/her(P@$$w0rd). public ActionResult EnableUser(string id, Asn2_GoodSam.Models.ApplicationDbContext context) { var thisUser = context.Users.Where(r => r.Id.Equals(id, StringComparison.CurrentCultureIgnoreCase)).FirstOrDefault(); Asn2_GoodSam.Models.TempPwd.TempPwdContext cxt = new Models.TempPwd.TempPwdContext(); var tempPwd = cxt.TempPwd.Where(r => r.Id.Equals(thisUser.Id, StringComparison.CurrentCulture)).FirstOrDefault(); thisUser.PasswordHash = tempPwd.Password; thisUser.LockoutEnabled = false; //context.Users.Remove(thisUser); thisUser.PhoneNumberConfirmed = false; context.Entry(thisUser).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); TempPwd pwd = dbTemp.TempPwd.Find(tempPwd.Id); dbTemp.TempPwd.Remove(pwd); dbTemp.SaveChanges(); return RedirectToAction("Index"); }