public TripDetailsController( ITripDetailsViewModelProvider generator, IAccountManager accountManager, ITripUserRepository tripUserRepository, ITripDetailsRepository tripDetailsRepository, IViewerTypeMapper viewerTypeMapper, IApplicationUserRepository applicationUserRepository, IFileReader <string> fileReader, IFileManagerFactory fileManagerFactory, IPdfCreator pdfCreator, INotificationProvider notificationProvider, IOfferStateEmailSender stateEmailSender, INotificationProvider htmlNotification, ITripTimeCollisionChecker tripTimeCollisionChecker) { this.generator = generator; this.accountManager = accountManager; this.tripUserRepository = tripUserRepository; this.tripDetailsRepository = tripDetailsRepository; this.viewerTypeMapper = viewerTypeMapper; this.applicationUserRepository = applicationUserRepository; this.fileReader = fileReader; this.notificationProvider = notificationProvider; this.stateEmailSender = stateEmailSender; this.htmlNotification = htmlNotification; fileManager = fileManagerFactory.GetManager(FileType.Json); pngFileManager = fileManagerFactory.GetManager(FileType.Png); this.pdfCreator = pdfCreator; this.tripTimeCollisionChecker = tripTimeCollisionChecker; }
public ViewerTypeProvider( IViewerTypeMapper typeMapper, IAccountManager accountManager, ITripDetailsRepository tripRepository, IApplicationUserRepository userRepository) { this.typeMapper = typeMapper; this.accountManager = accountManager; this.tripRepository = tripRepository; this.userRepository = userRepository; }
public async Task Invoke(HttpContext context, IViewerTypeMapper typeMapper, IAccountManager accountManager, ITripDetailsRepository repository) { var url = UriHelper.GetEncodedPathAndQuery(context.Request).ToLower(); if (context.Request.Path.ToString().ToLower() == "/tripdetails/index") { int id; if (!int.TryParse(context.Request.Query["id"], out id)) { return; } var user = await accountManager.GetUserAsync(context.User); var data = repository.GetTripWithPassengersById(id); var type = typeMapper.GetViewerType(user, data); context.Request.QueryString = new QueryString($"?id={id}&viewerType={type}"); } await next.Invoke(context); }