Exemple #1
0
        public async Task <ActionResult> LogIn(LoginModel model, string returnUrl, bool RememberMe)
        {
            if (ModelState.IsValid)
            {
                var results = await _loginbusiness.LogUserIn(model, RememberMe);

                if (results)
                {
                    return(RedirectToLocal(returnUrl));
                }
                else
                {
                    ModelState.AddModelError("", "Invalid username or password.");
                }
            }

            return(View(model));
        }
Exemple #2
0
        public async Task <ActionResult> LogIn(LoginModel model, string returnUrl, bool RememberMe)
        {
            if (ModelState.IsValid)
            {
                var results = await _loginbusiness.LogUserIn(model, RememberMe);

                if (results)
                {
                    if (!string.IsNullOrEmpty(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    TempData["message"] = "Hi " + model.Email.ToString().Split("@")[0] + " welcome back";
                    return(RedirectToAction("Reports", "Currency"));
                }
                else
                {
                    ModelState.AddModelError("", "Invalid username or password.");
                    return(View(model));
                }
            }

            return(View(model));
        }