Exemple #1
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BookingHistoryViewModel booking = _bookingHistoryManager.GetBookingHistory(id);

            ViewBag.VehicleId  = new SelectList(_vehicleManager.GetAllVehicle().Where(a => a.VehicleId == booking.VehicleId), "VehicleId", "LicencePlate", selectedValue: booking.VehicleId);
            ViewBag.ServiceId  = new SelectList(_serviceManager.GetAllService().Where(a => a.ServiceId == booking.ServiceId), "ServiceId", "ServiceName", selectedValue: booking.ServiceId);
            ViewBag.MechanicId = new SelectList(_mechanicManager.GetMechanicOfWashing(), "MechanicId", "Name");
            if (booking == null)
            {
                return(HttpNotFound());
            }
            return(View(booking));
        }
 public ActionResult Edit(BookingHistoryViewModel booking)
 {
     try
     {
         if (ModelState.IsValid)
         {
             string update = _bookingHistoryManager.updateBookingHistory(booking);
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception ex)
     {
         ModelState.AddModelError("", ex.Message);
     }
     ViewBag.VehicleId  = new SelectList(_vehicleManager.GetAllVehicle().Where(a => a.VehicleId == booking.VehicleId), "VehicleId", "LicencePlate", selectedValue: booking.VehicleId);
     ViewBag.ServiceId  = new SelectList(_serviceManager.GetAllService().Where(a => a.ServiceId == booking.ServiceId), "ServiceId", "ServiceName", selectedValue: booking.ServiceId);
     ViewBag.MechanicId = new SelectList(_mechanicManager.GetMechanicOfWashing(), "MechanicId", "Name");
     return(View(booking));
 }