public ActionResult bikeDetails(int bikeId, int page = 1)
        {
            if (!authorize()) { return RedirectToAction("authError", "Error"); }
            var model = new BikeShare.ViewModels.Maint.bikeDetailsVM();
            model.bikeId = bikeId;
            var bike = context.Bike.Find(bikeId);
            model.bikeName = bike.bikeName;
            model.bikeNumber = bike.bikeNumber;
            model.inspections = context.Inspection.Where(b => b.bikeId == bikeId).OrderByDescending(d => d.datePerformed).Take(15).ToList();
            model.maints = context.MaintenanceEvent.Where(b => b.bikeId == bikeId).OrderByDescending(d => d.timeAdded).Take(15).ToList();
            model.totalInspections = context.Inspection.Where(b => b.bikeId == bikeId).Count();
            model.totalCheckouts = context.CheckOut.Where(b => b.bike == bikeId).Count();

            return View(model);
        }
Beispiel #2
0
        public ActionResult bikeDetails(int bikeId, int page = 1)
        {
            if (!authorize())
            {
                return(RedirectToAction("authError", "Error"));
            }
            var model = new BikeShare.ViewModels.Maint.bikeDetailsVM();

            model.bikeId = bikeId;
            var bike = context.Bike.Find(bikeId);

            model.bikeName         = bike.bikeName;
            model.bikeNumber       = bike.bikeNumber;
            model.inspections      = context.Inspection.Where(b => b.bikeId == bikeId).OrderByDescending(d => d.datePerformed).Take(15).ToList();
            model.maints           = context.MaintenanceEvent.Where(b => b.bikeId == bikeId).OrderByDescending(d => d.timeAdded).Take(15).ToList();
            model.totalInspections = context.Inspection.Where(b => b.bikeId == bikeId).Count();
            model.totalCheckouts   = context.CheckOut.Where(b => b.bike == bikeId).Count();

            return(View(model));
        }