Exemplo n.º 1
0
        public async Task <TryResult <User> > RegisterAsync(string firstName, string middleName, string lastName, string email, string phone, string passwordHash)
        {
            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(passwordHash) || string.IsNullOrEmpty(phone))
            {
                return(new TryResult <User>(new Exception("Заполните все необходимые поля")));
            }

            currentUser = new User
            {
                Id           = ObjectId.GenerateNewId(),
                FirstName    = firstName,
                MiddleName   = middleName,
                LastName     = lastName,
                Phone        = phone,
                Email        = email,
                PasswordHash = passwordHash
            };

            return(await userStorage.CreateUserAsync(currentUser));
        }