예제 #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");
        }
예제 #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);
     }
 }
예제 #3
0
 public UserAccountService(UserService userService, RoleService roleService, IAuthContainer<string> authContainer)
 {
     _userService = userService;
     _roleService = roleService;
     _authContainer = authContainer;
 }
예제 #4
0
 public UserController(UserService service)
 {
     this.service = service;
 }