Пример #1
0
        private void CreateUser(
            User user,
            string initialRole = null)
        {
            if (_repository.FindByName(user.UserName) == null)
            {
                if (!string.IsNullOrEmpty(initialRole))
                {
                    user.Roles = new List <UserRoles>();
                    user.Roles.Add(new UserRoles()
                    {
                        Role = initialRole
                    });
                }

                _repository.Save(user);
            }
        }