public ActionResult Deleted(int id)
 {
     if (Session["matricn"] != null && Session["passw"] != null)
     {
         STUDENTCONTEXT sc  = new STUDENTCONTEXT();
         STUDENTS       stn = sc.AllStudent.Single(s => s.ID == id);
         return(View(stn));
     }
     return(RedirectToAction("Login", "admin"));
 }
Exemplo n.º 2
0
 public ActionResult Deletelist()
 {
     if (Session["matricn"] != null && Session["passw"] != null)
     {
         STUDENTCONTEXT  sc  = new STUDENTCONTEXT();
         List <STUDENTS> stn = sc.AllStudent.ToList();
         return(View(stn));
     }
     return(RedirectToAction("Login", "admin"));
 }
Exemplo n.º 3
0
        public ActionResult Delete_post(STUDENTS studentDelete)
        {
            if (Session["matricn"] != null && Session["passw"] != null)
            {
                STUDENTCONTEXT st = new STUDENTCONTEXT();
                st.DeleteStuedent(studentDelete);

                return(RedirectToAction("Deletelist", "admin"));
            }
            return(RedirectToAction("Login", "admin"));
        }
Exemplo n.º 4
0
 public ActionResult EditGet(int id)
 {
     if (Session["matricn"] != null && Session["passw"] != null)
     {
         STUDENTCONTEXT sc = new STUDENTCONTEXT();
         STUDENTS       s  = sc.AllStudent.Single(als => als.ID == id);
         ViewBag.ima = s.ST_IMAGE.ToString();
         return(View(s));
     }
     return(RedirectToAction("Login", "admin"));
 }
        public ActionResult Details(int id)
        {
            if (Session["Password"] != null && Session["userName"] != null || Session["matricn"] != null && Session["passw"] != null)
            {
                STUDENTCONTEXT sc = new STUDENTCONTEXT();

                STUDENTS stn = sc.AllStudent.Single(s => s.ID == id);
                return(View(stn));
            }


            return(RedirectToAction("Login", "Home"));
        }
Exemplo n.º 6
0
        public ActionResult Login(string nam, string pass)
        {
            STUDENTCONTEXT bc = new STUDENTCONTEXT();

            #region
            try
            {
                if (ModelState.IsValid)
                {
                    STUDENTS lg = bc.AllStudent.Where(k => k.MatricNumber.ToUpper() == nam.ToUpper() && k.ST_Password == pass).Single();

                    Session["Password"]    = lg.ST_Password;
                    Session["userName"]    = lg.MatricNumber;
                    Session["userprofile"] = lg.FirstName + " " + lg.LastName;
                    Session["id"]          = lg.ID;

                    if (Session["userName"] != null && Session["Password"] != null)
                    {
                        return(RedirectToAction("index"));
                    }
                }
            }
            catch (Exception)
            {
            }

            #endregion

            if (nam == "" || nam == null || pass == "" || pass == null)
            {
                if (nam == "" || nam == null)
                {
                    ViewBag.ErrorMessagename = "NAME IS REQUIRE";
                }
                if (pass == "" || pass == null)
                {
                    ViewBag.ErrorMessagepass = "******";
                }
            }
            else
            {
                ViewBag.ErrorMessage = "WRONG LOGIN";
            }

            return(View());
        }
Exemplo n.º 7
0
        public ActionResult Index(string Search_Data = "")
        {
            if (Session["matricn"] != null && Session["passw"] != null)
            {
                STUDENTCONTEXT  stc  = new STUDENTCONTEXT();
                List <STUDENTS> alst = stc.AllStudent.ToList();

                ViewBag.allstudentz = alst;

                BOOKCONTEXT bkc = new BOOKCONTEXT();

                List <BOOKS> bk = bkc.allBook.ToList();

                return(View(bk));
            }
            return(RedirectToAction("Login", "admin"));
        }
Exemplo n.º 8
0
        public ActionResult EditPost(STUDENTS stEdit)
        {
            if (Session["matricn"] != null && Session["passw"] != null)
            {
                STUDENTCONTEXT sc = new STUDENTCONTEXT();
                if (ModelState.IsValid)
                {
                    sc.EditStudent(stEdit);
                    return(RedirectToAction("Editlist", "admin"));
                }

                STUDENTS s = sc.AllStudent.Single(als => als.ID == stEdit.ID);
                ViewBag.ima = s.ST_IMAGE.ToString();
                return(View(s));
            }
            return(RedirectToAction("Login", "admin"));
        }
        public ActionResult Index(string searching = "")
        {
            if (Session["Password"] != null && Session["userName"] != null)
            {
                if (ModelState.IsValid)
                {
                    STUDENTCONTEXT  sc  = new STUDENTCONTEXT();
                    List <STUDENTS> stu = sc.AllStudent.Where(h => h.LastName.ToUpper().Contains(searching.ToUpper()) || h.FirstName.ToUpper().Contains(searching.ToUpper())).ToList();
                    return(View(stu));
                }
            }
            else
            {
                return(RedirectToAction("Login", "Home"));
            }



            return(RedirectToAction("Login", "Home"));
        }
Exemplo n.º 10
0
        public ActionResult Login(string matricNumber, string password)
        {
            if (ModelState.IsValid)
            {
                STUDENTCONTEXT uc     = new STUDENTCONTEXT();
                int            zcount = uc.AllStudent.Where(u => u.ST_Password == password && u.MatricNumber.ToUpper() == matricNumber.ToUpper()).Count();

                if (zcount > 0)
                {
                    STUDENTS usm = uc.AllStudent.Where(u => u.ST_Password == password && u.MatricNumber.ToUpper() == matricNumber.ToUpper()).Single();

                    Session["matricn"]    = usm.MatricNumber.ToUpper();
                    Session["passw"]      = usm.ST_Password;
                    Session["uID"]        = usm.ID;
                    Session["Userprofil"] = usm.FirstName.ToUpper() + " " + usm.LastName.ToUpper();

                    return(RedirectToAction("index", "Admin"));
                }
            }
            if (password == "" || matricNumber == "")
            {
                if (matricNumber == null || matricNumber == "")
                {
                    ViewBag.matri = "require matricNumber";
                }
                if (password == null || password == "")
                {
                    ViewBag.passer = "require password";
                }
            }

            else
            {
                ViewBag.loginerror = "WRONG LOGIN";
            }
            return(View());
        }
Exemplo n.º 11
0
        public ActionResult CreatePost(STUDENTS STUDENt)
        {
            if (Session["matricn"] != null && Session["passw"] != null)
            {
                if (ModelState.IsValid)
                {
                    STUDENTCONTEXT sc = new STUDENTCONTEXT();

                    string fileName    = Path.GetFileNameWithoutExtension(STUDENt.imgFile.FileName);
                    string exetensionx = Path.GetExtension(STUDENt.imgFile.FileName);

                    fileName        += DateTime.Now.ToString("symff") + exetensionx;
                    STUDENt.ST_IMAGE = "~/imagesUploads/" + fileName;
                    fileName         = Path.Combine(Server.MapPath("~/imagesUploads/"), fileName);
                    STUDENt.imgFile.SaveAs(fileName);


                    sc.AddStudent(STUDENt);
                    return(RedirectToAction("index", "Admin"));
                }
                return(View());
            }
            return(RedirectToAction("Login", "admin"));
        }