public void AddUser(string FirstName,string SecondName,string MonthBirthDay,string DayBirthDay,string YearBirthDay,string EmailAddress,string ConfirmEmailAddress,string FirstPartCellPhone, string SecondPartCellPhone,string ThirdPartCellPhone,string ZipCode,string Password,string ConfirmPassword) { messageToBeShown = ""; User user = new User(FirstName, SecondName, new UserDateOfBirth(MonthBirthDay, YearBirthDay, DayBirthDay), EmailAddress, new UserCellPhone(FirstPartCellPhone, SecondPartCellPhone, ThirdPartCellPhone), ZipCode, Password); if (!confirmationEmailMatch(user,ConfirmEmailAddress)) { messageToBeShown = "Email and confirmation eamail do not match"; return; } if (!confirmationPasswordMatch(user,ConfirmPassword)) { messageToBeShown = "Password and confirmationPassword do not match"; return; } if (alreadyExistsUser(user)) { messageToBeShown = "A user with specified email already exists"; return; } try { userDM.Add(user); messageToBeShown = "User succesfuly added"; } catch (InvalidUserException invalidUserException) { messageToBeShown = invalidUserException.Message; } }
//[HttpPost] public ActionResult LogIn(User model) { var userEmail = model.email; var userPassword = model.password; // ViewBag.message("Numele: " + userPassword + "Parola: " + userEmail); return View(model); }
private bool alreadyExistsUser(User user) { List<User> usersList = userDM.GetAllUsers(); for (int index = 0; index < usersList.Count; index++) { if (usersList[index].EmailAddress.Equals(user.EmailAddress)) { return true; } } return false; }
public void Add(User User) { try { UserValidator userValidator = new UserValidator(); userValidator.Validate(User); usersList.Add(User); } catch (InvalidUserException invalidUserException) { throw invalidUserException; } }
public ActionResult LogIn2(User user) { UserDM userMap = new UserDM(); if (ModelState.IsValid) { if (userMap.checkUserLogin(user)) { return RedirectToAction("Index", "Home"); } ModelState.AddModelError("", "Login data is incorrect!"); } return View(user); }
private void Init() { var newUser = new User(); newUser.Id = 1; newUser.firstName = "User1FN"; newUser.secondName = "User1SN"; newUser.email = "*****@*****.**"; newUser.password = "******"; newUser.zipCode = 12345; newUser.cellPhone = "0755555555"; _usersList.Add(newUser); newUser = new User(); newUser.Id = 2; newUser.firstName = "User2FN"; newUser.secondName = "User2SN"; newUser.email = "*****@*****.**"; newUser.password = "******"; newUser.zipCode = 12345; newUser.cellPhone = "0755555555"; _usersList.Add(newUser); newUser = new User(); newUser.Id = 3; newUser.firstName = "User3FN"; newUser.secondName = "User3SN"; newUser.email = "*****@*****.**"; newUser.password = "******"; newUser.zipCode = 12345; newUser.cellPhone = "0755555555"; _usersList.Add(newUser); }
private bool confirmationEmailMatch(User user, string confirmationEmail) { return user.EmailAddress.Equals(confirmationEmail); }
private bool confirmationPasswordMatch(User user, string confirmationPassword) { return user.Password.Equals(confirmationPassword); }
public void RemoveUser(User user) { _usersList.Remove(user); >>>>>>> 88e733912c7fd449e56c94f6fe867a5f49ca79fa }
public void AddUser(User user) { _usersList.Add(user); }