Beispiel #1
0
        public IActionResult SetTechnician(int id)
        {
            var session = new TechnicianSession(HttpContext.Session);

            session.SetId(id);
            return(RedirectToAction("List"));
        }
        public IActionResult Index(string activeConf = "all", string activeDiv = "all")
        {
            var session = new TechnicianSession(HttpContext.Session);

            session.SetActiveConf(activeConf);
            session.SetActiveDiv(activeDiv);

            var model = new Technician
            {
                Name        = activeConf,
                Email       = activeDiv,
                Conferences = context.Conference,
                Divisions   = context.Divisions
            };

            IQueryable <Technician> query = context.Technicians;

            if (activeConf != "all")
            {
                query = query.Where(
#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast
                    t => t.Conference == activeConf.ToLower());
            }
#pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast
            if (activeDiv != "all")
            {
                query = query.Where(
#pragma warning disable CS0252 // Possible unintended reference comparison; left hand side needs cast
                    t => t.Division == activeDiv.ToLower());
            }
#pragma warning restore CS0252 // Possible unintended reference comparison; left hand side needs cast
            model.Technicians = query.ToList();

            return(View(model));
        }
Beispiel #3
0
        public IActionResult List()
        {
            var session = new TechnicianSession(HttpContext.Session);
            var tid     = session.GetId();

            if (tid == -1)
            {
                return(RedirectToAction("SelectTechnician"));
            }

            var incidents = unitOfWork.IncidentRepository.Get(includeProperties: "Technician,Customer,Product").Where(i => i.TechnicianId == tid).
                            Where(i => i.DateClosed == null).ToList();

            ViewBag.Name = unitOfWork.TechnicianRepository.Get(tid).Name;
            return(View(incidents));
        }