Example #1
0
        public ActionResult LogIn(UserViewModel user)
        {
            UserService us = new UserService();
            UserViewModel temp=null;

            try
            {
                temp = us.LogInUser(user);
            }

            catch (DAL.Exceptions.Exceptions.WrongPasswordException ex)
            {
                ModelState.AddModelError("",  ex.Message);
                return View(user);

            }
            catch(DAL.Exceptions.Exceptions.WrongLoginException ex )

            {
                ModelState.AddModelError("",  ex.Message);
                return View(user);
            }
            catch {

                return null ;

            }
            Session["UserID"] = temp.Id;

            return RedirectToAction("Index", "Home");
        }
Example #2
0
 public ActionResult SignUp(UserViewModel user)
 {
     UserService us = new UserService();
     if (!us.CheckIfUserExistsByNickOrEmail(user))
     {
         us.AddUserToDatabase(user);
         return RedirectToAction("Index", "Home");
     }
     else
     {
         ModelState.AddModelError("", "Podany użytkownik lub email jest już zarejestrowany");
         return View(user);
     }
 }
Example #3
0
 public ActionResult RemindPassword(UserViewModel user)
 {
     return View();
 }