public ActionResult CreateAccount(UserAccount model) { ViewBag.backLink = "Login"; using (UserAccountDB userAccountDB = new UserAccountDB()) { userAccountDB.UserDetails.Add(model); userAccountDB.SaveChanges(); return(View(model)); } }
public ActionResult DeleteAccount(int ID) { using (UserAccountDB userAccountDB = new UserAccountDB()) { UserAccount user_dtls = userAccountDB.UserDetails.Where(w => w.UserDetailId == ID).First(); string lcldeleteMsg = "Account was deleted: " + user_dtls.Email; userAccountDB.UserDetails.Remove(user_dtls); userAccountDB.SaveChanges(); ViewBag.deleteMsg = "Account was deleted"; return(RedirectToAction("ManageAccounts", new { deleteMsg = lcldeleteMsg })); } }
public ActionResult EditAccount(UserAccount model) { using (UserAccountDB userAccountDB = new UserAccountDB()) { userAccountDB.Configuration.ValidateOnSaveEnabled = false; UserAccount user_dtls = userAccountDB.UserDetails.Where(w => w.UserDetailId == model.UserDetailId).First(); userAccountDB.Entry(user_dtls).CurrentValues.SetValues(model); userAccountDB.SaveChanges(); ViewBag.backLink = "MagaeAccounts"; return(View(user_dtls)); } }