public ActionResult DeleteConfirmed(int id) { tblAuthenticate tblAuthenticate = db.tblAuthenticates.Find(id); db.tblAuthenticates.Remove(tblAuthenticate); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "id,uid,userName,password,dateAdded")] tblAuthenticate tblAuthenticate) { if (ModelState.IsValid) { db.Entry(tblAuthenticate).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.uid = new SelectList(db.tblUsers, "uid", "fname", tblAuthenticate.uid); return(View(tblAuthenticate)); }
// GET: tblAuthenticates/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblAuthenticate tblAuthenticate = db.tblAuthenticates.Find(id); if (tblAuthenticate == null) { return(HttpNotFound()); } return(View(tblAuthenticate)); }
// GET: tblAuthenticates/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblAuthenticate tblAuthenticate = db.tblAuthenticates.Find(id); if (tblAuthenticate == null) { return(HttpNotFound()); } ViewBag.uid = new SelectList(db.tblUsers, "uid", "fname", tblAuthenticate.uid); return(View(tblAuthenticate)); }
protected void submit_Click(object sender, EventArgs e) { if (pass1.Text == pass2.Text) { tblUser user = Session["user"] as tblUser; tblAuthenticate auth = db.tblAuthenticates.SingleOrDefault(x => x.uid == user.uid); auth.password = pass1.Text; db.SaveChanges(); Session["userName"] = auth.userName; if (user.role == "U") { Response.Redirect("User/Dashboard"); } else if (user.role == "A") { Response.Redirect("Admin/Index"); } else { Label1.Text = "Some error ocuured , please contact us at [email protected]"; Label1.ForeColor = Color.Red; } } }