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)); }
public async Task <IActionResult> Create([Bind("Id,Name,ContactNumber,Email")] VehicleOwner vehicleOwner) { if (ModelState.IsValid) { _context.Add(vehicleOwner); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(vehicleOwner)); }
public async Task <IActionResult> Create([Bind("Id,ServiceName,ServiceCharge,Description")] Service service) { if (ModelState.IsValid) { _context.Add(service); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(service)); }