コード例 #1
0
 public ActionResult Login(AspUserLoginForm form)
 {
     try
     {
         ViewBag.Success = true;
         ViewBag.Message = "Success";
         if (!ModelState.IsValid)
         {
             throw new Exception();
         }
         AspUserService service = new AspUserService();
         int?           id      = service.CheckPassword(form.Mail, form.Password);
         if (id is null)
         {
             throw new Exception();
         }
         AspUser user = service.Get((int)id);
         Utils.SessionUser = user;
         return(RedirectToAction("Index"));
     }
     catch (Exception)
     {
         ViewBag.Success = false;
         ViewBag.Message = "Failed";
         return(View(form));
     }
 }
コード例 #2
0
        public ActionResult Login()
        {
            AspUserLoginForm form = new AspUserLoginForm();

            return(View(form));
        }