public ActionResult Create(User user) { if (ModelState.IsValid) { user.UsersID = Guid.NewGuid(); db.Users.Add(user); db.SaveChanges(); return RedirectToAction("Index"); } return View(user); }
public ActionResult AccountSetting(User user) { try { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; user.ModifiedDate = DateTime.Now; db.SaveChanges(); TempData["ErrorMsg"] = "data has been updated successfully."; } else { TempData["ErrorMsg"] = "Error: Something went wrong, please try again."; } } catch (Exception ex) { TempData["ErrorMsg"] = "Error: " + ex.Message; } return View(user); }
public ActionResult Registration(User user) { user.UsersID = Guid.NewGuid(); user.ModifiedDate = DateTime.Now; user.CreateDate = DateTime.Now; user.IsAdmin = false; db.Users.Add(user); db.SaveChanges(); Session["UserName"] = user.EmailID; Session["FirstName"] = user.FristName; return RedirectToAction("PayNow","Home"); }
public ActionResult Edit(User user) { if (ModelState.IsValid) { db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(user); }