コード例 #1
0
        public IActionResult Index(FilterModel model)
        {
            // Pull the grants from grants.gov, get the ones relevant to
            // the user's choices, and then sort them by score.
            GrantScraperModel generator = new GrantScraperModel(model);

            // If the user pressed any buttons, send a list of grants relevant
            // to the choices they made.
            if (getFilterBoolStates())
            {
                // Send the grants to the webpage.
                ViewData["Grants"] = generator.getGrants(model);
            }

            // Return to the webpage.
            return(View(model));



            // Create local functions here.
            bool getFilterBoolStates()
            {
                return(model.grantTypeContains(true) || model.locationContains(true) ||
                       model.raceContains(true) || (model.religiousAffiliationContains("yes") && model.religiousIdentificationContains(true)) ||
                       model.grantDueDateContains(true) || model.grantAmountContains(true) || model.type501c3Contains("yes"));
            }
        }