Exemplo n.º 1
0
        public ActionResult Login(LoginViewModel model)
        {
            if (ModelState.IsValid)
            {
                MyUserManager user_manager       = new MyUserManager();
                BusinessLayerResult <MyUser> res = user_manager.LoginUser(model);

                if (res.Errors.Count > 0)
                {
                    res.Errors.ForEach(x => ModelState.AddModelError("", x.Message));



                    return(View(model));
                }

                Session["login"] = res.Result;                 // SESSION
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }