public async Task <IActionResult> Edit(int id, [Bind("ServiceId,Description,Duration,Price")] Service service) { if (id != service.ServiceId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(service); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ServiceExists(service.ServiceId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(service)); }
public async Task <IActionResult> Edit(int id, [Bind("ApointId,ServiceId,EmployeeId,Time,Location,PetName")] Appointments appointments) { if (id != appointments.ApointId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(appointments); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppointmentsExists(appointments.ApointId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["EmployeeId"] = new SelectList(_context.Employee, "EmployeeId", "LastName", appointments.EmployeeId); ViewData["ServiceId"] = new SelectList(_context.Service, "ServiceId", "Description", appointments.ServiceId); return(View(appointments)); }
public async Task <IActionResult> Edit(int id, [Bind("EmployeeId,FirstName,LastName,Specialty")] Employee employee) { if (id != employee.EmployeeId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(employee); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EmployeeExists(employee.EmployeeId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(employee)); }