public async Task <ActionResult> AppointmentOptions(AppointmentOptionsViewModel appointmentoption) { bool success = false; if (!ModelState.IsValid) { return(PartialView("_AppointmentOptions", appointmentoption)); } var appointment = await _appointmentServices.GetAppointment(appointmentoption.AppNo); string phyId = appointment.Phys_id; DateTime appdate = (DateTime)appointment.AppointDate; switch (appointmentoption.AppOptions) { case AppointOptions.Cancel: appointment.IsCancelled = true; _appointmentServices.ModifyAppointment(appointment); success = true; break; case AppointOptions.Remove: _appointmentServices.RemoveAppointment(appointment); success = true; break; case AppointOptions.Replace: if (appointment.Pat_Id != appointmentoption.RepIdNo) { //get medical record var medicalRecord = _patientRecordServices.GetMedicalRecordByAppointment(appointment.No); if (medicalRecord != null) { //remove medical record _patientRecordServices.RemoveMedicalRecord(medicalRecord); } //update appointment appointment.Pat_Id = appointmentoption.RepIdNo; _appointmentServices.ModifyAppointment(appointment); success = true; } break; case AppointOptions.Serve: appointment.Status = true; _appointmentServices.ModifyAppointment(appointment); success = true; break; } if (success == true) { appointHub = new AppointHub(); //var id = _userPhysicianService.GetPhysicianUserId(phyId); _unitofwork.Commit(); var appointSchedulebydoctor = await _appointmentServices.GetAllAppointmentList(); appointHub.SendAppointment(phyId, appointSchedulebydoctor.Where(t => t.PhyId == phyId && t.AppointDate == appdate).ToList()); } var url = Url.Action("GetAppointment_By_Doctor", "Appointment", new { id = phyId, appdate = appdate }); return(Json(new { success = success, url = url }, JsonRequestBehavior.AllowGet)); }