public ActionResult Save(AppointmentModel appointment) { if (!ModelState.IsValid) { return(View("AppointmentForm", new AppointmentViewModel() { Appointment = appointment, Medics = _usersRepo.GetMedicsForAppointment(), Pets = _petsRepo.GetPetsByOwner(ApplicationHelper.LoggedUser.Id) })); } try { _appointmentsRepo.AddOrUpdate(appointment); } catch (Exception e) { return(HttpNotFound()); } if (appointment.Id == 0) { return(RedirectToAction("Index", "Appointment")); } return(RedirectToAction("Show", new { id = appointment.Id })); }