コード例 #1
0
 public ActionResult submitChargeAndMaint(string userName, string title, string details, int rackId, decimal chargeAmount, int bikeId, string disableBike)
 {
     if (!authorize()) { return RedirectToAction("authError", "Error"); }
     Charge charge = new Charge
     {
         amountCharged = chargeAmount,
         dateAssesed = DateTime.Now,
         dateResolved = DateTime.Now,
         title = title,
         description = details,
         user = context.BikeUser.Where(u => u.userName == userName).First()
     };
     context.Charge.Add(charge);
     var maintenance = new MaintenanceEvent { timeAdded = DateTime.Now, bikeId = bikeId, timeResolved = null, title = title, details = details, disableBike = !String.IsNullOrEmpty(disableBike) };
     maintenance.submittedById = context.BikeUser.Where(u => u.userName == User.Identity.Name).First().bikeUserId;
     if (maintenance.disableBike)
         context.Bike.Find(bikeId).onMaintenanceHold = true;
     context.MaintenanceEvent.Add(maintenance);
     context.SaveChanges();
     return RedirectToAction("Index", new { rackId = rackId });
 }
コード例 #2
0
 public ActionResult submitMaint(string maintTitle, string maintDetails, int rackId, int bikeId, string disableBike)
 {
     if (!authorize()) { return RedirectToAction("authError", "Error"); }
     var maintenance = new MaintenanceEvent { timeAdded = DateTime.Now, bikeId = bikeId, timeResolved = null, title = maintTitle, details = maintDetails, disableBike = !String.IsNullOrEmpty(disableBike) };
     if(maintenance.disableBike)
         context.Bike.Find(bikeId).onMaintenanceHold = true;
     maintenance.submittedById = context.BikeUser.Where(u => u.userName == User.Identity.Name).First().bikeUserId;
     context.MaintenanceEvent.Add(maintenance);
     context.SaveChanges();
     return RedirectToAction("Index", new { rackId = rackId });
 }
コード例 #3
0
 public ActionResult newMaintenance(int bikeId)
 {
     if (!authorize()) { return RedirectToAction("authError", "Error"); }
     var model = new MaintenanceEvent();
     model.bikeId = bikeId;
     return View(model);
 }