Пример #1
0
 public ActionResult LogOn(User model, string returnUrl)
 {
     if (ModelState.IsValid)
     {
         if (membershipService().ValidateUser(model.UserName, model.Password))
         {
             formsService().SignIn(model.UserName, false);
             if (!String.IsNullOrEmpty(returnUrl))
             {
                 return Redirect(returnUrl);
             }
             else
             {
                 return RedirectToAction("Index", "Members");
             }
         }
         else
         {
             ModelState.AddModelError("", "Please try again");
         }
     }
     return View(model);
 }
Пример #2
0
        public ActionResult Register(User model)
        {
            if (ModelState.IsValid)
            {
                var repo = userRepository();
                repo.Insert(model);
                if(repo.Commit())
                {
                    formsService().SignIn(model.UserName, false);
                    return RedirectToAction("Index", "Home");
                }

            }
            return View(model);
        }
Пример #3
0
 public ActionResult LogOn()
 {
     var u = new User();
     return View(u);
 }