public async Task <IActionResult> Edit(int id, [Bind("Id,DateTimeStart,ServiceId,DoctorId,PatientFullname,PatientPhone")] Appointment appointment) { if (id != appointment.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(appointment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AppointmentExists(appointment.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["DoctorId"] = new SelectList(_context.Doctor, "Id", "Fullname", appointment.DoctorId); ViewData["ServiceId"] = new SelectList(_context.Service, "Id", "Name", appointment.ServiceId); return(View(appointment)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Price")] 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,Fullname,Profile")] Doctor doctor) { if (id != doctor.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(doctor); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DoctorExists(doctor.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(doctor)); }