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 });
 }
 public ActionResult submitCharge(string userName, string chargeTitle, string chargeDetails, int rackId, decimal chargeAmount)
 {
     if (!authorize()) { return RedirectToAction("authError", "Error"); }
     Charge charge = new Charge
     {
         amountCharged = chargeAmount,
         dateAssesed = DateTime.Now,
         dateResolved = DateTime.Now,
         title = chargeTitle,
         description = chargeDetails,
         user = context.BikeUser.Where(u => u.userName == userName).First()
     };
     context.Charge.Add(charge);
     context.SaveChanges();
     return RedirectToAction("Index", new { rackId = rackId });
 }