예제 #1
0
        public ViewResult TechIncident(IncidentViewModel inc)

        {
            var techId     = inc.CurrentIncident.TechnicianID;
            var technician = TechnicianRepository.Get(t => t.TechnicianID == techId).Single();
            var model      = new IncidentViewModel
            {
                ActiveIncident   = inc.ActiveIncident,
                Incidents        = IncidentRepository.Get(orderBy: i => i.OrderBy(ii => ii.Title)).ToList(),
                Technicians      = TechnicianRepository.Get(orderBy: t => t.OrderBy(tt => tt.Name)).ToList(),
                Customers        = CustomerRepository.Get(orderBy: c => c.OrderBy(cc => cc.FirstName)).ToList(),
                Products         = ProductRepository.Get(orderBy: p => p.OrderBy(pp => pp.Name)).ToList(),
                ActiveTechnician = technician.Name
            };

            return(View(model));
        }
예제 #2
0
        public ViewResult ListByTech(string activeIncident = "All", string activeTechnician = "All")
        {
            var model = new IncidentViewModel
            {
                //ActiveIncident = activeIncident,
                ActiveTechnician = activeTechnician,
                //Incidents = context.Incidents.OrderBy(i => i.Title).ToList(),
                Technicians = TechnicianRepository.Get(orderBy: technicians => technicians.OrderBy(c => c.Name)).ToList()
            };
            IEnumerable <Incident> query = IncidentRepository.Get();

            if (activeIncident != "All")
            {
                query = IncidentRepository.Get(incident => incident.IncidentID.ToString() == activeIncident);
            }
            if (activeTechnician != "All")
            {
                query = IncidentRepository.Get(i => i.Technician.TechnicianID.ToString() == activeTechnician);
            }
            model.Incidents = query.ToList();
            return(View(model));
        }
예제 #3
0
        public ViewResult EditIncident(int id)
        {
            Incident activeIncident = IncidentRepository.Get(id);
            var      model          = new IncidentViewModel
            {
                Action          = "EditIncident",
                Technicians     = TechnicianRepository.Get(orderBy: t => t.OrderBy(tt => tt.Name)).ToList(),
                Customers       = CustomerRepository.Get(orderBy: c => c.OrderBy(cc => cc.FirstName)).ToList(),
                Products        = ProductRepository.Get(orderBy: p => p.OrderBy(pp => pp.Name)).ToList(),
                CurrentIncident = IncidentRepository.Get(id)
            };

            IEnumerable <Incident> query = IncidentRepository.Get();

            if (activeIncident.IncidentID != 0)
            {
                query = IncidentRepository.Get(i => i.IncidentID == activeIncident.IncidentID);
            }
            model.Incidents       = query.ToList();
            model.CurrentIncident = IncidentRepository.Get(id);

            return(View("EditIncident", model));
        }
예제 #4
0
        public ViewResult TechIncident(string activeIncident = "All", string activeTechnician = "All")
        {
            var model = new IncidentViewModel
            {
                ActiveIncident   = activeIncident,
                ActiveTechnician = activeTechnician,
                Incidents        = IncidentRepository.Get(orderBy: i => i.OrderBy(ii => ii.Title)).ToList(),
                Technicians      = TechnicianRepository.Get(orderBy: t => t.OrderBy(tt => tt.Name)).ToList(),
                Customers        = CustomerRepository.Get(orderBy: c => c.OrderBy(cc => cc.FirstName)).ToList(),
                Products         = ProductRepository.Get(orderBy: p => p.OrderBy(pp => pp.Name)).ToList()
            };
            IEnumerable <Incident> query = IncidentRepository.Get();

            if (activeIncident != "All")
            {
                query = IncidentRepository.Get(i => i.IncidentID.ToString() == activeIncident);
            }
            if (activeTechnician != "All")
            {
                query = IncidentRepository.Get(i => i.Technician.TechnicianID.ToString() == activeIncident);
            }
            model.Incidents = query.ToList();
            return(View(model));
        }