Exemplo n.º 1
0
        public ActionResult Index(pharmacist objchk)
        {
            if (ModelState.IsValid)
            {
                using (Pharmacy_DBEntities7 db = new Pharmacy_DBEntities7())
                {
                    var obj = db.pharmacists.Where(a => a.Username.Equals(objchk.Username) && a.Password.Equals(objchk.Password)).FirstOrDefault();
                    if (obj != null)
                    {
                        Session["UserID"]   = obj.UserID.ToString();
                        Session["Password"] = obj.Password.ToString();
                        return(RedirectToAction("Index", "Home"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "The ID or Password Incorrect");
                    }
                }
            }

            return(View(objchk));
        }