예제 #1
0
        public ActionResult Index(LoginModel credentials)
        {
            var entities = new Models.db38bab79d27554b96b50aa57c010cd149Entities3();

            if (credentials != null)
            {
                var dbUser = entities.Participants.Where(x => x.Username == credentials.Username && x.Password == credentials.Password).SingleOrDefault();
                if (dbUser != null)
                {
                    Session["User"] = credentials.Username;
                    return Welcome();
                }
            }
            credentials.Message = "Invalid login";
            return View(credentials);
        }
예제 #2
0
        public ActionResult Login(LoginModel model)
        {
            if (adminPasswordsByUsername.ContainsKey(model.Username) && adminPasswordsByUsername[model.Username] == model.Password)
            {
                Session["User"] = model.Username;
                return Dashboard();
            }

            model.Message = "Invalid login";
            return View(model);
        }