public ActionResult Registration( string login, string password1, string password2, string email, string name, string surname, string lastname, string birthday) { Regex emailRegex = new Regex(@"\A[^@]+@([^@\.]+\.)+[^@\.]+\z"); //TODO: datetime regex var regViewModel = new RegistrationViewModel { Password = password1, Name = name, Surname = surname, LastName = lastname, Email = email, Birthday = birthday, Login = login, IsEmailError = email != null ? !emailRegex.IsMatch(email) : false, IsPassError = (password1 == null || password2 == null) ? false : password1 != password2, IsLoginError = _userService.UserExists(login) }; if (!regViewModel.HaveError()) { _userService.AddUser(Mapper.Map <RegistrationViewModel, User>(regViewModel)); return(RedirectToAction("Login", "Base")); } else { return(View(regViewModel)); } }