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