public ActionResult About() { // Testowa operacja czy wszystko działa var logic = new UserLogic(); logic.AddAdmin(); return(View()); }
public async Task <ActionResult> Login([Bind(Include = "login,passwordHash,passwordSalt,email,firstName,lastName")] User user) { UserRepository userRepository = new UserRepository(); if (userRepository.GetAll().Count() == 0) { UserLogic userLogic = new UserLogic(); userLogic.AddAdmin(); } User DBuser = await db.Users.FindAsync(user.login); if ((DBuser != null) && (passwordLogic.TestPasswordHasher(user.passwordSalt, DBuser.passwordSalt, DBuser.passwordHash))) { logged = true; login = DBuser.login; RouteConfig.RegisterRoutes(RouteTable.Routes); return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("passwordSalt", "Niepoprawny login lub hasło"); return(View(user)); }