public async Task <IActionResult> Edit(int id, [Bind("EvaluationId,Resulte,Title,Description,BookingLogId")] Evaluation evaluation) { if (id != evaluation.EvaluationId) { return(NotFound()); } if (ModelState.IsValid) { try { dataContext.Update(evaluation); await dataContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EvaluationExists(evaluation.EvaluationId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BookingLogId"] = new SelectList(dataContext.BookingLog, "BookingLogId", "CustomerId", evaluation.BookingLogId); return(View(evaluation)); }
public async Task <IActionResult> Edit(int id, [Bind("CustomerId,FirstName,LastName,EmailAddress,Street,DateBirth,MobilePhone,PostalDistrictId")] Customer customer) { if (id != customer.CustomerId) { return(NotFound()); } if (ModelState.IsValid) { try { dataContext.Update(customer); await dataContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomerExists(customer.CustomerId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["PostalDistrictId"] = new SelectList(dataContext.PostalDistrict, "PostalDistrictId", "Zipcode"); return(View(customer)); }
public async Task <IActionResult> Edit(int id, [Bind("ActivityId,Price,Title,StartDate,EndDate,BookingLogId,VehicleId")] ActivityType activityType) { if (id != activityType.ActivityTypeId) { return(NotFound()); } if (ModelState.IsValid) { try { dataContext.Update(activityType); await dataContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ActivityTypeExists(activityType.ActivityTypeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } //ViewData["BookingLogId"] = new SelectList(dataContext.BookingLog, "BookingLogId", "BookingLogId", activityType.BookingLogId); ViewData["VehicleId"] = new SelectList(dataContext.Vehicle, "VehicleId", "VehicleModel", activityType.VehicleId); return(View(activityType)); }
public async Task <IActionResult> Edit(int id, [Bind("StaffId,FirstName,LastName,EmailAddress,Street,MobilePhone")] Staff staff) { if (id != staff.StaffId) { return(NotFound()); } if (ModelState.IsValid) { try { dataContext.Update(staff); await dataContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StaffExists(staff.StaffId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(staff)); }
public async Task <IActionResult> Edit(int id, [Bind("PostalDistrictId,City,Zipcode")] PostalDistrict postalDistrict) { if (id != postalDistrict.PostalDistrictId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(postalDistrict); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostalDistrictExists(postalDistrict.PostalDistrictId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(postalDistrict)); }
public async Task <IActionResult> Edit(int id, [Bind("VehicleId,VehicleModel,RegistrationDtl")] Vehicle vehicle) { if (id != vehicle.VehicleId) { return(NotFound()); } if (ModelState.IsValid) { try { dataContext.Update(vehicle); await dataContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VehicleExists(vehicle.VehicleId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(vehicle)); }
public async Task <IActionResult> Edit(int id, [Bind("BookingLogId,CreatedBy,CreatedDate,LastModifiedDate,LastModifiedBy,StaffId,CustomerId,ActivityTypeId")] BookingLog bookingLog) { if (id != bookingLog.BookingLogId) { return(NotFound()); } if (ModelState.IsValid) { try { dataContext.Update(bookingLog); await dataContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookingLogExists(bookingLog.BookingLogId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ActivityTypeId"] = new SelectList(dataContext.ActivityType, "ActivityTypeId", "Title,Price,StartDate,EndDate,Vehicle", bookingLog.ActivityTypeId); ViewData["CustomerId"] = new SelectList(dataContext.Customer, "CustomerId", "FirstName", bookingLog.CustomerId); ViewData["StaffId"] = new SelectList(dataContext.Staff, "StaffId", "FirstName", bookingLog.StaffId); return(View(bookingLog)); }