public ActionResult DeleteConfirmed(string id) { BCG_Portal.Models.User applicationUser = db.Users.Find(id); db.Users.Remove(applicationUser); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Email,EmailConfirmed,PasswordHash,SecurityStamp,PhoneNumber,PhoneNumberConfirmed,TwoFactorEnabled,LockoutEndDateUtc,LockoutEnabled,AccessFailedCount,UserName")] BCG_Portal.Models.User applicationUser) { if (ModelState.IsValid) { db.Entry(applicationUser).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(applicationUser)); }
// GET: ApplicationUsers/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BCG_Portal.Models.User applicationUser = db.Users.Find(id); if (applicationUser == null) { return(HttpNotFound()); } return(View(applicationUser)); }
public async Task <ActionResult> ExternalLoginConfirmation(ExternalLoginConfirmationViewModel model, string returnUrl) { if (User.Identity.IsAuthenticated) { return(RedirectToAction("Index", "Manage")); } if (ModelState.IsValid) { // Get the information about the user from the external login provider var info = await AuthenticationManager.GetExternalLoginInfoAsync(); if (info == null) { return(View("ExternalLoginFailure")); } var user = new BCG_Portal.Models.User { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user); if (result.Succeeded) { result = await UserManager.AddLoginAsync(user.Id, info.Login); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); return(RedirectToLocal(returnUrl)); } } AddErrors(result); } ViewBag.ReturnUrl = returnUrl; return(View(model)); }