Пример #1
0
        public HomeController(IUserCreationService service, IImageService imageService, IUserQueryService queryService)
        {
            if (service == null)
            {
                throw new System.ArgumentNullException("subjectQueryService", "Subject auery service is null.");
            }
            this.service      = service;
            this.imageService = imageService;
            this.queryService = queryService;

            service.CreateUser("admin", "*****@*****.**", "admin");
            service.AddUserRole("*****@*****.**", "Администратор");
        }
        public MembershipUser CreateUser(string name, string email, string password)
        {
            MembershipUser membershipUser = GetUser(email, false);

            if (membershipUser == null)
            {
                try
                {
                    userCreationService.CreateUser(name, email, password);

                    //userCreationService.AddUserRole(email, "Пользователь");

                    membershipUser = GetUser(email, false);
                    return(membershipUser);
                }
                catch
                {
                    return(null);
                }
            }
            return(null);
        }
Пример #3
0
 public Task StartAsync(CancellationToken cancellationToken)
 {
     _userCreationService.CreateRole();
     _userCreationService.CreateUser();
     return(Task.CompletedTask);
 }