public IActionResult ConfirmAppointment(DetailsViewModel viewModel) { //var id = RouteData.Values["id"]; var appointment = _Appointments.getAppointmentById(Convert.ToInt32(viewModel.Appointment.Id)); if (!viewModel.Appointment.isConfirmed) { ModelState.AddModelError("NotChecked", "You haven't confirmed in checkbox!"); DetailsViewModel vm = new DetailsViewModel() { Appointment = appointment, Comments = _CommentRepository.getCommentsConnectedWithThisId(appointment.Id).ToList() }; return(View("Details", vm)); } //_Appointments[id].isConfirmed; // appointment.isConfirmed = viewModel.Appointment.isConfirmed; // _Appointments.getAppointmentById(Convert.ToInt32(id)).isConfirmed = viewModel.Appointment.isConfirmed; // _appDbContext.SaveChanges(); _Appointments.ConfirmAppointment(viewModel.Appointment.Id); return(RedirectToAction("Index")); }