示例#1
0
 public ActionResult Register(RegisterModel model)
 {
     if (ModelState.IsValid)
     {
         UserProcessor userProcessor = new UserProcessor();
         if (userProcessor.CreateUser(model))
         {
             return RedirectToAction("Index", "Home");
         }
         else
         {
             return View(model);
         }
     }
     else
         return View(model);
 }
示例#2
0
 public ActionResult LogOn(LogOnModel model, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         UserProcessor userProsessor=new UserProcessor();
         if (userProsessor.Authenticate(model.Email, model.Password))
         {
             return RedirectToAction("Index", "Home");
         }
         else
         {
             ModelState.AddModelError("", "Incorrect username or password");
             return View();
         }
     }
     else
     {
         return View();
     }
 }