public async Task <IActionResult> Edit(int id, [Bind("Id,ServiceName,ServiceCharge,Description")] Service service) { if (id != service.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(service); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceExists(service.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(service)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,ContactNumber,Email")] VehicleOwner vehicleOwner) { if (id != vehicleOwner.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vehicleOwner); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VehicleOwnerExists(vehicleOwner.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(vehicleOwner)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ServiceId,VehicleOwnerId")] ServiceBookingRecord serviceBookingRecord) { if (id != serviceBookingRecord.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(serviceBookingRecord); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceBookingRecordExists(serviceBookingRecord.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ServiceId"] = new SelectList(_context.Service, "Id", "Id", serviceBookingRecord.ServiceId); ViewData["VehicleOwnerId"] = new SelectList(_context.Set <VehicleOwner>(), "Id", "Id", serviceBookingRecord.VehicleOwnerId); return(View(serviceBookingRecord)); }