Example #1
0
 /// <summary>
 /// Instancie une nouvelle instance de <see cref="UsersController"/>.
 /// </summary>
 /// <param name="appSettings">La configuration de l'application.</param>
 /// <param name="userService">Le <see cref="IUserService"/>.</param>
 /// <param name="userPasswordResetTokenService">Le <see cref="IUserPasswordResetTokenService"/>.</param>
 /// <param name="emailService">Le <see cref="IEmailService"/>.</param>
 /// <param name="logger">Le logger utilisé.</param>
 /// <param name="localizer">Les ressources localisées.</param>
 public UsersController(
     IOptions <AppSettings> appSettings,
     IUserService userService,
     IUserPasswordResetTokenService userPasswordResetTokenService,
     IEmailService emailService,
     ILogger <UsersController> logger,
     IStringLocalizer <UsersController> localizer)
 {
     this.appSettings = appSettings?.Value;
     this.userService = userService;
     this.userPasswordResetTokenService = userPasswordResetTokenService;
     this.emailService = emailService;
     this.logger       = logger;
     this.localizer    = localizer;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="UsersController"/> class.
        /// </summary>
        /// <param name="appSettings">The application configuration.</param>
        /// <param name="logger">The logger to use.</param>
        /// <param name="localizer">The localized ressources to use.</param>
        /// <param name="userService">The <see cref="IUserService"/>.</param>
        /// <param name="userPasswordResetTokenService">the <see cref="IUserPasswordResetTokenService"/>.</param>
        /// <param name="emailService">The <see cref="IEmailService"/>.</param>
        public UsersController(
            IOptions <AppSettings> appSettings,
            ILogger <UsersController> logger,
            IStringLocalizer <UsersController> localizer,
            IUserService userService,
            IUserPasswordResetTokenService userPasswordResetTokenService,
            IEmailService emailService)
        {
            if (appSettings == null)
            {
                throw new ArgumentNullException(nameof(appSettings));
            }
            else
            {
                this.appSettings = appSettings?.Value;
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            else
            {
                this.logger = logger;
            }

            if (localizer == null)
            {
                throw new ArgumentNullException(nameof(localizer));
            }
            else
            {
                this.localizer = localizer;
            }

            if (userService == null)
            {
                throw new ArgumentNullException(nameof(userService));
            }
            else
            {
                this.userService = userService;
            }

            if (userPasswordResetTokenService == null)
            {
                throw new ArgumentNullException(nameof(userPasswordResetTokenService));
            }
            else
            {
                this.userPasswordResetTokenService = userPasswordResetTokenService;
            }

            if (emailService == null)
            {
                throw new ArgumentNullException(nameof(emailService));
            }
            else
            {
                this.emailService = emailService;
            }
        }