Esempio n. 1
0
        public async Task <IActionResult> Index(
            [FromServices] DataContext dataContext,
            [FromServices] IContentfulService contentfulService)
        {
            SimpleNotifier noty = notifier();

            noty.AddMessage(MsgTypes.Information, "TIP: Try changing Map Layers (top right)");

            IQueryable <Need> allNeedsPosts = dataContext.Needs.Include(n => n.NeedPpeTypes);

            //This logic is intentionally "fluffy", we are (justifiably) bumping up the Met and Partially Met percentages
            //by excluding posts from the "total" which volunteers cannot possibly meet: see notes on IsNotMarkedAllNotMetAndIsContactable etc

            int countAllNeedsPosts = allNeedsPosts.Count();
            int countSeeminglyContactableNeedsPosts = allNeedsPosts.ToList().Count(n => n.IsNotMarkedAllNotMetAndIsContactable());

            IQueryable <Need> fullyMetNeeds = allNeedsPosts.Where(p => p.NeedPpeTypes.All(pt => pt.StatusId == (int)PpeStatus.Met));
            int countFullyMetNeeds          = fullyMetNeeds.Count();
            int countPartiallyMetNeeds      = allNeedsPosts.Except(fullyMetNeeds).Count(p => p.NeedPpeTypes.Any(pt => pt.StatusId == (int)PpeStatus.Met));

            ViewData["met"]     = countFullyMetNeeds;
            ViewData["partial"] = countPartiallyMetNeeds;
            ViewData["new"]     = countSeeminglyContactableNeedsPosts - (countFullyMetNeeds + countPartiallyMetNeeds);

            ViewData["contactable"]    = countSeeminglyContactableNeedsPosts;
            ViewData["noncontactable"] = countAllNeedsPosts - countSeeminglyContactableNeedsPosts;
            ViewData["contentful"]     = await contentfulService.GetFirstByContentType <HomePageViewModel>("home-page");

            return(View());
        }
Esempio n. 2
0
 public EbayClient(IOptions <EbayConfig> ebayConfig, IContentfulService contentfulService, ICacheService cacheService, IBaseClient baseClient) : base(baseClient)
 {
     _ebayConfig        = ebayConfig.Value;
     _contentfulService = contentfulService;
     _cacheService      = cacheService;
     _baseClient        = baseClient;
 }
Esempio n. 3
0
 public ProductsController(
     ICacheService cacheService, IEmailService emailService, IEtsyClient etsyClient, IEbayClient ebayClient,
     IOptions <EbayConfig> ebayConfig, IInstagramClient instagramClient, IContentfulService contentfulService)
     : base(contentfulService)
 {
     _cacheService    = cacheService;
     _emailService    = emailService;
     _etsyClient      = etsyClient;
     _ebayClient      = ebayClient;
     _ebayConfig      = ebayConfig.Value;
     _instagramClient = instagramClient;
 }
Esempio n. 4
0
 public BaseController(IContentfulService contentfulService)
 {
     _contentfulService = contentfulService;
 }
Esempio n. 5
0
 public ErrorController(IContentfulService contentfulService) : base(contentfulService)
 {
 }
Esempio n. 6
0
 public ContactController(IEmailService emailService, IContentfulService contentfulService) : base(contentfulService)
 {
     _emailService = emailService;
 }
Esempio n. 7
0
        public async Task <IActionResult> Partners([FromServices] IContentfulService contentfulService)
        {
            ViewData["contentful"] = await contentfulService.GetFirstByContentType <PartnersPageViewModel>("partners-page");

            return(View());
        }
Esempio n. 8
0
        public async Task <IActionResult> About([FromServices] IContentfulService contentfulService)
        {
            ViewData["contentful"] = await contentfulService.GetFirstByContentType <AboutUsPageViewModel>("about-us-page");

            return(View());
        }
Esempio n. 9
0
 public DynamicController(IContentfulService contentfulService) : base(contentfulService)
 {
 }
Esempio n. 10
0
 public InstagramController(IOptions <InstagramConfig> instagramConfig, IInstagramClient client, IContentfulService contentfulService) : base(contentfulService)
 {
     _instagramConfig = instagramConfig.Value;
     _client          = client;
 }