public IViewComponentResult Invoke()
        {
            var data = IncidentProcessor.LoadIncidents();
            List <IncidentModel> incidents = new List <IncidentModel>();

            foreach (var row in data)
            {
                incidents.Add(new IncidentModel
                {
                    ID       = row.ID,
                    Title    = row.Title,
                    Context  = row.Context,
                    Customer = row.Customer,
                    Employee_ID_CreatedBy = row.Employee_ID_CreatedBy,
                    Employee_ID_EndedBy   = row.Employee_ID_EndedBy,
                    CustomerEmail         = row.CustomerEmail,
                    DateTimeStart         = row.DateTimeStart,
                    DateTimeEnded         = row.DateTimeEnd,
                    Status = row.Status
                }
                              );
            }

            var sortedIncidents = incidents.Where(q => q.Status == "open").Take(3);

            return(View(sortedIncidents));
        }
Esempio n. 2
0
        public IActionResult ViewIncidents()
        {
            var data = IncidentProcessor.LoadIncidents();
            List <IncidentModel> incidents = new List <IncidentModel>();

            foreach (var row in data)
            {
                incidents.Add(new IncidentModel
                {
                    ID       = row.ID,
                    Title    = row.Title,
                    Context  = row.Context,
                    Customer = row.Customer,
                    Employee_ID_CreatedBy = row.Employee_ID_CreatedBy,
                    Employee_ID_EndedBy   = row.Employee_ID_EndedBy,
                    CustomerEmail         = row.CustomerEmail,
                    DateTimeStart         = row.DateTimeStart,
                    DateTimeEnded         = row.DateTimeEnd,
                    Status = row.Status
                }
                              );
            }

            var sortedIncidents = incidents.OrderBy(q => q.Status.ToString().Length).ThenByDescending(q => q.DateTimeStart);

            return(View(sortedIncidents));
        }