public ActionResult Create(apta_admin adminmodel)
        {
            try
            {
                using (ModelsCMS db = new ModelsCMS())
                {
                    db.apta_admins.Add(adminmodel);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("Error"));
            }
        }
示例#2
0
        public ActionResult adminLogin(apta_admin admin)
        {
            ModelsCMS db           = new ModelsCMS();
            var       userLoggedIn = db.apta_admins.SingleOrDefault(x => x.Email == admin.Email && x.Password == admin.Password);

            if (userLoggedIn != null)
            {
                ViewBag.message1  = "loggedin";
                ViewBag.triedOne1 = "yes";
                return(RedirectToAction("adminHome", "Home", new { Email = admin.Email }));
            }
            else
            {
                ViewBag.triedOnce = "yes";
                return(View("Error"));
            }
        }