public ActionResult DeleteConfirmed(int id) { proUser proUser = db.proUsers.Find(id); db.proUsers.Remove(proUser); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "userID,firstname,lastname,email,password,phoneNumber,dateCreated,dateModified")] proUser proUser) { if (ModelState.IsValid) { db.Entry(proUser).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(proUser)); }
// GET: proUsers/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } proUser proUser = db.proUsers.Find(id); if (proUser == null) { return(HttpNotFound()); } return(View(proUser)); }
// [ValidateAntiForgeryToken] public ActionResult Create([Bind(Include = "firstname,lastname,email,password,phoneNumber")] proUser proUser) { if (ModelState.IsValid) { DateTime dt = DateTime.Now.Date; proUser.dateCreated = dt; db.proUsers.Add(proUser); db.SaveChanges(); FormsAuthentication.SetAuthCookie(proUser.firstname, false); return(RedirectToAction("Dashboard", "projects")); } return(View(proUser)); }
public ActionResult SignIn(proUser user) { string firstname = db.proUsers.Where(y => y.email == user.email && y.password == user.password).Select(y => y.email).SingleOrDefault(); if (firstname != null) { FormsAuthentication.SetAuthCookie(firstname, false); return(RedirectToAction("Dashboard", "projects")); } TempData["Message"] = "Email or Password is Incorrect"; return(View()); }
public ActionResult AutoComplete(proUser user) { try { string term = user.email; if (term.Length > 0) { return(Json(db.proUsers.Where(x => x.email.StartsWith(term)).Select(y => y.email).ToArray(), JsonRequestBehavior.AllowGet)); } else { return(Json("No record", JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(ex.Message + ex.StackTrace, JsonRequestBehavior.AllowGet)); } }