public IActionResult AppointmentDetails(int AppointmentId) { ReserveAppointmentViewModel model; try { Appointment appointment = repository.GetAppointmentById(AppointmentId); AppUser user = GetUser().Result; int PatientId = (int)user.PatientId; model = new ReserveAppointmentViewModel(repository, appointment, user.Id, AppointmentId, PatientId); } catch (Exception ex) { return(View("Error", null)); } return(View(model)); }
public IActionResult ReserveAppointment(ReserveAppointmentViewModel model) { bool check = repository.ReserveAppointment(model); if (check) { Appointment appointment = repository.GetAppointmentByIdAllData(model.AppointmentId); repository.AddCommentToComplete(model.PatientId, appointment); Subject subject = new Subject(); Observer obserwer = new Observer(subject, repository, model.PatientId); subject.MakeNotificationReservedAppointment(model.timeSelected); subject.notifyObservers(); return(RedirectToAction("AppointmentDetails", new { AppointmentId = model.AppointmentId })); } else { return(View("Error", null)); } }