예제 #1
0
 public ActionResult CreateAccount(UserAccount model)
 {
     ViewBag.backLink = "Login";
     using (UserAccountDB userAccountDB = new UserAccountDB())
     {
         userAccountDB.UserDetails.Add(model);
         userAccountDB.SaveChanges();
         return(View(model));
     }
 }
예제 #2
0
 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 }));
     }
 }
예제 #3
0
 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));
     }
 }