public RSPrincipal(RSUser user) { User = user; }
public async Task<ActionResult> Create(RSUser user, string newpassword, string confirmpassword) { if (ModelState.IsValid) { db.Users.Add(user); if (newpassword == confirmpassword) { user.DependencyInjection(); user.CreatePassword(newpassword); } else { ViewBag.ShowMessage = true; ViewBag.MessageColor = "red"; ViewBag.Message = Resources.Resources.PasswordsDontMatch; return View(user); } await db.SaveChangesAsync(); return RedirectToAction("Index"); } return View(user); }
public async Task<ActionResult> Edit(RSUser user, string newpassword, string confirmpassword) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; if (!string.IsNullOrWhiteSpace(newpassword) & newpassword == confirmpassword) { user.DependencyInjection(); user.CreatePassword(newpassword); } await db.SaveChangesAsync(); return RedirectToAction("Index"); } return View(user); }