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)); }
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)); }
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)); }
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)); }