public JsonResult generateuri(string id = "")
 {
     try
     {
         if (!string.IsNullOrEmpty(id))
         {
             AppointmentSchedule lappointment = lIAppointmentScheduleRepository.GetAppointment(id);
             if (lappointment != null && lappointment.PatientId.HasValue)
             {
                 Patient lpatient = IPatient.GetPatientByPatientID(lappointment.PatientId.Value);
                 if (lpatient != null)
                 {
                     User pPatient            = lIUserRepository.getUser(lpatient.PatientLoginId);
                     User pTherapistorSupport = lIUserRepository.getUser(lappointment.UserId);
                     if (pPatient != null && !string.IsNullOrEmpty(pPatient.Vseeid) && pTherapistorSupport != null && !string.IsNullOrEmpty(pTherapistorSupport.Vseeid))
                     {
                         VSeeHelper vsee   = new VSeeHelper();
                         dynamic    resURI = vsee.GetURI(pTherapistorSupport.Vseeid, pTherapistorSupport.Password, pPatient.Vseeid);
                         if (resURI != null)
                         {
                             lappointment.VseeUrl = resURI;
                             int _result = lIAppointmentScheduleRepository.UpdateAppointment(lappointment);
                             if (_result > 0)
                             {
                                 return(Json(new { result = "success", url = resURI }));
                             }
                             else
                             {
                                 return(Json(""));
                             }
                         }
                         else
                         {
                             return(Json(""));
                         }
                     }
                     else
                     {
                         return(Json(""));
                     }
                 }
                 else
                 {
                     return(Json(""));
                 }
             }
             else
             {
                 return(Json(""));
             }
         }
         else
         {
             return(Json(""));
         }
     }
     catch (Exception ex)
     {
         return(Json(""));
     }
 }
        public JsonResult updateappointment(string appointmentid)
        {
            string timezoneid = TimeZoneInfo.Local.SupportsDaylightSavingTime ? TimeZoneInfo.Local.DaylightName : TimeZoneInfo.Local.StandardName;//"US Eastern Standard Time";//

            try
            {
                if (!string.IsNullOrEmpty(appointmentid))
                {
                    AppointmentSchedule lappointment = lIAppointmentScheduleRepository.GetAppointment(appointmentid);
                    if (lappointment != null && lappointment.PatientId.HasValue)
                    {
                        Patient lpatient = IPatient.GetPatientByPatientID(lappointment.PatientId.Value);
                        if (lpatient != null)
                        {
                            User pPatient            = lIUserRepository.getUser(lpatient.PatientLoginId);
                            User pTherapistorSupport = lIUserRepository.getUser(lappointment.UserId);
                            if (pPatient != null && !string.IsNullOrEmpty(pPatient.Vseeid) && pTherapistorSupport != null && !string.IsNullOrEmpty(pTherapistorSupport.Vseeid))
                            {
                                VSeeHelper vsee   = new VSeeHelper();
                                dynamic    resURI = vsee.GetURI(pTherapistorSupport.Vseeid, pTherapistorSupport.Password, pPatient.Vseeid);
                                if (resURI != null)
                                {
                                    lappointment.VseeUrl = resURI;
                                    int _result = lIAppointmentScheduleRepository.UpdateAppointment(lappointment);
                                    if (_result > 0)
                                    {
                                        return(Json(new { Status = (int)HttpStatusCode.OK, result = "success", url = resURI, TimeZone = timezoneid }));
                                    }
                                    else
                                    {
                                        return(Json(new { Status = (int)HttpStatusCode.Created, result = "not updated", TimeZone = timezoneid }));
                                    }
                                }
                                else
                                {
                                    return(Json(new { Status = (int)HttpStatusCode.Created, result = "not updated", TimeZone = timezoneid }));
                                }
                            }
                            else
                            {
                                return(Json(new { Status = (int)HttpStatusCode.Created, result = "not updated", TimeZone = timezoneid }));
                            }
                        }
                        else
                        {
                            return(Json(new { Status = (int)HttpStatusCode.BadRequest, result = "patient is not registered", TimeZone = timezoneid }));
                        }
                    }
                    else
                    {
                        return(Json(new { Status = (int)HttpStatusCode.BadRequest, result = "appointment is not registered", TimeZone = timezoneid }));
                    }
                }
                else
                {
                    return(Json(new { Status = (int)HttpStatusCode.Created, result = "request string is not proper", TimeZone = timezoneid }));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "Internal server error", TimeZone = timezoneid }));
            }
        }