示例#1
0
        public ActionResult Index(Guid?crewId = null)
        {
            using (var context = new WorkOrderContext()) {
                if (!context.WorkOrders.Any(w => w.Date >= DateTime.Today))
                {
                    context.Reset();
                }

                if (!(crewId.HasValue))
                {
                    var crews = context.Crews.OrderBy(c => c.Name).ToList();
                    var model = new ChooseCrewModel {
                        Crews = crews
                    };

                    return(View("ChooseCrew", model));
                }

                var crew = context.Crews.FirstOrDefault(c => c.Id == crewId.Value);

                var workOrders = context.WorkOrders
                                 .Include(w => w.Crew)
                                 .Include(w => w.Category)
                                 .Include(w => w.WorkOrderLogs)
                                 .Where(w => !w.IsComplete && w.CrewId == crewId.Value)
                                 .ToList();

                var viewModel = new CrewListViewModel(crew, workOrders);

                return(View(viewModel));
            }
        }
示例#2
0
        public ActionResult Index(Guid? crewId = null)
        {
            using (var context = new WorkOrderContext()) {
                if (!context.WorkOrders.Any(w => w.Date >= DateTime.Today)) {
                    context.Reset();
                }

                if (!(crewId.HasValue)) {
                    var crews = context.Crews.OrderBy(c => c.Name).ToList();
                    var model = new ChooseCrewModel { Crews = crews };

                    return View("ChooseCrew", model);
                }

                var crew = context.Crews.FirstOrDefault(c => c.Id == crewId.Value);

                var workOrders = context.WorkOrders
                    .Include(w => w.Crew)
                    .Include(w => w.Category)
                    .Include(w => w.WorkOrderLogs)
                    .Where(w => !w.IsComplete && w.CrewId == crewId.Value)
                    .ToList();

                var viewModel = new CrewListViewModel(crew, workOrders);

                return View(viewModel);
            }
        }
示例#3
0
        public ActionResult Index()
        {
            using (var context = new WorkOrderContext()) {
                if (!context.WorkOrders.Any(w => w.Date >= DateTime.Today))
                {
                    context.Reset();
                }

                var workOrders = context.WorkOrders
                                 .Include(w => w.Crew)
                                 .Include(w => w.Category)
                                 .Include(w => w.WorkOrderLogs)
                                 .ToList();

                var viewModel = new BossListViewModel(workOrders);
                return(View(viewModel));
            }
        }
示例#4
0
        public ActionResult Index()
        {
            using (var context = new WorkOrderContext()) {

                if (!context.WorkOrders.Any(w => w.Date >= DateTime.Today)) {
                    context.Reset();
                }

                var workOrders = context.WorkOrders
                    .Include(w => w.Crew)
                    .Include(w => w.Category)
                    .Include(w => w.WorkOrderLogs)
                    .ToList();

                var viewModel = new BossListViewModel(workOrders);
                return View(viewModel);
            }
        }