Esempio n. 1
0
        private static IEnumerable <CveSummaryModel> SortCves(string sortedBy, IEnumerable <CveSummaryModel> cves)
        {
            switch (sortedBy)
            {
            case "severity":
                return(ReportUtils.GetSortedCvesBySeverity(cves));

            case "severityDesc":
                return(ReportUtils.GetSortedCvesBySeverity(cves).Reverse());

            case "name":
                return(cves.OrderByDescending(x => x.Name));

            case "nameDesc":
                return(cves.OrderBy(x => x.Name));

            case "frequency":
                return(cves.OrderByDescending(x => x.Frequency));

            case "frequencyDesc":
                return(cves.OrderBy(x => x.Frequency));

            default:
                return(ReportUtils.GetSortedCvesBySeverity(cves));
            }
        }
Esempio n. 2
0
        public ActionResult <CveSummaryModel> GetAllCve(string sortedBy)
        {
            var cves = ReportUtils.GetSortedCvesBySeverity(this.reports.GetCveSummary());

            if (sortedBy != null)
            {
                cves = SortCves(sortedBy, cves);
            }

            return(Ok(cves));
        }
Esempio n. 3
0
        public IActionResult GetAllCveHtml(string sortedBy)
        {
            var cves = ReportUtils.GetSortedCvesBySeverity(this.reports.GetCveSummary());

            if (sortedBy != null)
            {
                cves             = SortCves(sortedBy, cves);
                ViewBag.SortedBy = sortedBy;
            }
            else
            {
                ViewBag.SortedBy = "severity";
            }

            return(View("~/Controllers/Pages/CVEGroupSummary.cshtml", cves));
        }