public MailBoxController(IProvider provider, UserManager <ApplicationUser> userManager, JanuszMailDbContext dbContext) { this._provider = provider; this._userManager = userManager; this._dbContext = dbContext; this._mailBoxViewModel = new MailBoxViewModel(); }
public ExchangeProfileViewModel(ProfileRegister register, ExchangeProfileDataStore.Factory storeFactory, ExchangeAuthenticationService authenticationService, AutoMapper.IMapper mapper) : base(register) { _storeFactory = storeFactory; _client = new GraphServiceClient( "https://graph.microsoft.com/v1.0", new DelegateAuthenticationProvider(async(request) => { try { var result = await authenticationService.AcquireTokenSilentAsync(EmailAddress); var token = result.AccessToken; request.Headers.Authorization = new AuthenticationHeaderValue("bearer", token); } catch (Exception ex) { IsAuthenticated = false; this.Log().Error(ex, $"Failed to silently authenticate {EmailAddress}."); } })); _mailService = new ExchangeMailService(register, _storeFactory, _client, mapper); var queryFactory = new RelayProfileDataQueryFactory(register.DataFilePath, path => storeFactory.Invoke(path, false)); MailBox = new MailBoxViewModel(queryFactory, _mailService); }
public FakeProfileViewModel(ProfileRegister register, Profile state, FakeProfileDataQueryFactory queryFactory, FakeMailService mailService) : base(register) { MailBox = new MailBoxViewModel(queryFactory, mailService); DisplayName = state.DisplayName; }