public IActionResult Delete(int id) { var appointment = _appointmentService.GetById(id); if (appointment == null) { return(NotFound()); } var model = new AppointmentDeleteViewModel() { Id = appointment.Id, AppointmentName = appointment.AppointmentName }; return(View(model)); }
public async Task <IActionResult> Delete(AppointmentDeleteViewModel model) { await _appointmentService.Delete(model.Id); return(RedirectToAction(nameof(Index))); }