public static bool Registration(string login, string password, Profile profile) { var userDataAccess = new UserDataAccess(); var userList = userDataAccess.Select(); var profileDataAccess = new ProfileDataAccess(); foreach (var element in userList) { if (element.Login == login) { return(false); } } //Проверяю на валидность Email var isValid = EmailValidationService.IsValidEmail(profile.Email); if (isValid) { var user = new User() { Login = login, Password = EncryiptionService.GetHashString(password) }; userDataAccess.Insert(user); profileDataAccess.Insert(profile); return(true); } else { return(false); } }
public Profile SaveToProfile(Account account) { var profileDataAccess = new ProfileDataAccess(); var profile = new Profile(); profile.Login = account.Login; Console.Write("Напишите Имя: "); profile.FirstName = Console.ReadLine(); Console.Write("Напишите Фамилию: "); profile.LastName = Console.ReadLine(); Console.Write("Напишите Email: "); profile.Email = Console.ReadLine(); Console.Write("Напишите путь к картинке: "); profile.PathToImage = Console.ReadLine(); profileDataAccess.Insert(profile); return(profile); }