コード例 #1
0
ファイル: SeedDB.cs プロジェクト: mauro2912/MyVet
        private async Task <User> CheckUserAsync(string document, string firstName, string lastName,
                                                 string email, string phone, string address, string role)
        {
            var user = await _userHelper.GetUserByEmailAsync(email);

            if (user == null)
            {
                user = new User
                {
                    FirstName   = firstName,
                    LastName    = lastName,
                    Email       = email,
                    UserName    = email,
                    PhoneNumber = phone,
                    Address     = address,
                    Document    = document
                };

                await _userHelper.AddUserAsync(user, "123456");

                await _userHelper.AddUser2RoleAsync(user, role);
            }

            return(user);
        }