public ActionResult AddAccountToRepository(string Name, string FirstName, string Lastname, string paswd, string secondpaswd, string email)
        {
            if (paswd != secondpaswd)
            {
                TempData["LoginErrorMessage"] = "Podano różne od siebie hasła!";
                return(RedirectToAction("AddAccount"));
            }
            else if (String.IsNullOrWhiteSpace(Name) == true && String.IsNullOrWhiteSpace(FirstName) == true && String.IsNullOrWhiteSpace(Lastname) == true && String.IsNullOrWhiteSpace(paswd) == true && String.IsNullOrWhiteSpace(secondpaswd) == true && String.IsNullOrWhiteSpace(email) == true)
            {
                TempData["LoginErrorMessage"] = "Któreś z pól nie zostało wypełnione!";
                return(RedirectToAction("AddAccount"));
            }
            else
            {
                if (repository.CheckIfUserExist(Name) == true)
                {
                    TempData["LoginErrorMessage"] = "Istnieje już o takiej samej nazwie użytkownik!";
                    return(RedirectToAction("AddAccount"));
                }

                var keyNew   = Helper.GeneratePassword(10);
                var password = Helper.EncodePassword(paswd, keyNew);

                repository.AddUserToRepository(FirstName + "_" + Lastname, Name, password, keyNew, email);
                TempData["LoginErrorMessage"] = "Udało się stworzyć konto ! Od teraz możesz się logować!";
                return(RedirectToAction("Login"));
            }
        }
        public ActionResult AddManuallyUser(string NameOfUser, string FirstName, string Lastname, string paswd, string secondpaswd, string email, string AdminName, string AdminNickname)
        {
            if (paswd != secondpaswd)
            {
                TempData["AdminMessage"] = "Podano różne od siebie hasła!";
                return(RedirectToAction("AddAccount"));
            }
            else
            {
                var keyNew   = Helper.GeneratePassword(10);
                var password = Helper.EncodePassword(paswd, keyNew);

                userRepository.AddUserToRepository(FirstName + "_" + Lastname, NameOfUser, password, keyNew, email);

                TempData["AdminMessage"] = "Udało się stworzyć konto !";



                return(RedirectToAction("AddManuallyUser", new { Name = AdminName, NickName = AdminNickname }));
            }
        }