public HttpResponseMessage FetchDoctorTimeWeb(FetchTimingsModel searchModel) { try { //var dateTime = DateTime.Parse(searchModel.appDate); string[] formats = { "dd/MM/yyyy" }; var dateTime = DateTime.ParseExact(searchModel.appDate.Trim(), formats, new CultureInfo("en-US"), DateTimeStyles.None); string appday = dateTime.ToString("dddd"); //var result = db.SP_FetchDoctorTimings(searchModel.doctorID, dateTime).ToList(); var timings = (from t in db.DoctorTimings where t.doctorID == searchModel.doctorID && t.utcDay == appday && t.active == true select new TimingsVM { doctorID = t.doctorID, fromtime = t.@from, totime = t.to }).ToList(); var appointments = (from app in db.Appointments where app.doctorID == searchModel.doctorID && app.appDate == dateTime select new AppointmentsVM { appTime = app.appTime }).ToList(); DocTimingsAndAppointment result = new DocTimingsAndAppointment(); result.timingsVM = timings; result.appointmentVM = appointments; response = Request.CreateResponse(HttpStatusCode.OK, result); return(response); } catch (Exception ex) { return(ThrowError(ex, "FetchDoctorTimeWeb in SearchDoctorController")); } }
public DocTimingsAndAppointment FetchDoctorTimesNew(FetchTimingsModel searchModel) { try { var strContent = JsonConvert.SerializeObject(searchModel); var response = ApiConsumerHelper.PostData("api/fetchDoctorTimeWeb/?searchModel", strContent); var result = JsonConvert.DeserializeObject <DocTimingsAndAppointment>(response); return(result); } catch (HttpResponseException ex) { throw ex; } }
public List <FetchDoctorTimingModel> FetchDoctorTimes(FetchTimingsModel searchModel) { try { var strContent = JsonConvert.SerializeObject(searchModel); var response = ApiConsumerHelper.PostData("api/fetchDoctorTime/?searchModel", strContent); var result = JsonConvert.DeserializeObject <List <FetchDoctorTimingModel> >(response); return(result); } catch (HttpResponseException ex) { throw ex; } }
public HttpResponseMessage FetchDoctorTimeNew(FetchTimingsModel searchModel) { try { //var dateTime = DateTime.Parse(searchModel.appDate); string[] formats = { "dd/MM/yyyy" }; var dateTime = DateTime.ParseExact(searchModel.appDate.Trim(), formats, new CultureInfo("en-US"), DateTimeStyles.None); string appday = dateTime.ToString("dddd"); //List<SP_FetchDoctorTimings_Result> appList = new List<SP_FetchDoctorTimings_Result>(); //appList = db.SP_FetchDoctorTimings(searchModel.doctorID, dateTime).ToList(); var doctimings = (from t in db.DoctorTimings where t.doctorID == searchModel.doctorID && t.utcDay == appday && t.active == true select new TimingsVM { doctorID = t.doctorID, fromtime = t.@from, totime = t.to }).ToList(); var appointments = (from app in db.Appointments where app.doctorID == searchModel.doctorID && app.appDate == dateTime select new AppointmentsVM { appTime = app.appTime }).ToList(); DocTimingsAndAppointment appList = new DocTimingsAndAppointment(); appList.timingsVM = doctimings; appList.appointmentVM = appointments; List <string> timings = new List <string>(); if (appList != null) { //calculate time slots timings = createTimeSlots(appList);//displayTimeSlots(appList); timings = timings.OrderBy(x => DateTime.ParseExact(x, "hh:mm tt", CultureInfo.InvariantCulture)).ToList(); //timings = displayTimeSlots(appList);//displayTimeSlots(appList); } response = Request.CreateResponse(HttpStatusCode.OK, timings); return(response); } catch (Exception ex) { return(ThrowError(ex, "FetchDoctorTimeNew in SearchDoctorController")); } }
public HttpResponseMessage FetchDoctorTime(FetchTimingsModel searchModel) { try { //var dateTime = DateTime.Parse(searchModel.appDate); string[] formats = { "dd/MM/yyyy" }; var dateTime = DateTime.ParseExact(searchModel.appDate.Trim(), formats, new CultureInfo("en-US"), DateTimeStyles.None); string appday = dateTime.ToString("dddd"); var result = db.SP_FetchDoctorTimings(searchModel.doctorID, dateTime).ToList(); response = Request.CreateResponse(HttpStatusCode.OK, result); return(response); } catch (Exception ex) { return(ThrowError(ex, "FetchDoctorTime in SearchDoctorController")); } }
public JsonResult FetchDoctorTimingsNew(FetchTimingsModel model) { try { SeeDoctorRepository objSeeDoctorRepo = new SeeDoctorRepository(); DocTimingsAndAppointment appList = new DocTimingsAndAppointment(); appList = objSeeDoctorRepo.FetchDoctorTimesNew(model); List <string> timings = new List <string>(); if (appList != null) { //calculate time slots timings = createTimeSlots(appList); } return(Json(new { Success = true, Object = timings })); } catch (System.Web.Http.HttpResponseException ex) { return(Json(new { Message = ex.Response })); } }