public ActionResult DeleteConfirmed(int id)
        {
            tblLibrarian tblLibrarian = db.tblLibrarians.Find(id);

            db.tblLibrarians.Remove(tblLibrarian);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "LibrarianID,LibrarianName,Email,Password")] tblLibrarian tblLibrarian)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblLibrarian).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tblLibrarian));
 }
        public ActionResult Create([Bind(Include = "LibrarianID,LibrarianName,Email,Password")] tblLibrarian tblLibrarian)
        {
            if (ModelState.IsValid)
            {
                db.tblLibrarians.Add(tblLibrarian);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(tblLibrarian));
        }
        // GET: tblLibrarians/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            tblLibrarian tblLibrarian = db.tblLibrarians.Find(id);

            if (tblLibrarian == null)
            {
                return(HttpNotFound());
            }
            return(View(tblLibrarian));
        }
Example #5
0
        public ActionResult Login(tblLibrarian user)
        {
            var adm = adminDb.tblLibrarians.SingleOrDefault(a => a.Email == user.Email && a.Password == user.Password);

            if (adm != null)
            {
                Session["userId"]   = adm.LibrarianID;
                Session["userName"] = adm.LibrarianName;
                return(RedirectToAction("LIndex", "TblBooks", new { userId = adm.LibrarianID, userName = adm.LibrarianName }));
            }
            else if (user.Email == null && user.Password == null)
            {
                return(View());
            }
            ViewBag.Message = "User name and password are not matching";
            return(View());
        }