Example #1
0
        public ActionResult test(login test)
        {
            using (var _db = new AriskaEntities())
            {
                var rows = (from myRow in _db.logins
                            select new loginModel
                            {
                                userid = myRow.userid,
                                password = myRow.password,

                            }).ToList();
            }
            return View();
        }
Example #2
0
        public ActionResult LogIntest1(loginModel loginmodel)
        {
            using (var _db = new AriskaEntities())
            {

                var user = (from myRow in _db.logins
                            where ((loginmodel.userid == myRow.userid) && (loginmodel.password == myRow.password) )
                            select new loginModel
                            {
                                userid = myRow.userid,
                                password = myRow.password,

                            }).SingleOrDefault();

                if (user != null)
                {
                    TempData["UserId"] = user.userid;
                    return RedirectToAction("DashBoard");
                }
                if(loginmodel.userid != null || loginmodel.password != null)
                {
                    ModelState.AddModelError("", "Invalid username or password");
                }
            }
            return View();
        }