public HttpResponseMessage AppointmentSchedule(HttpRequestMessage request, DateTime?datetime, string type = null, int hospitalid = 0) { AppointScheduleViewModel asvm = new AppointScheduleViewModel(); List <tbScheduleData> result = null; if (type == null) { result = scheduledataRepo.Get().Where(a => a.IsDeleted != true & a.AppointmentDatetime.Value.Day == datetime.Value.Day && a.HospitalID == hospitalid).ToList(); asvm.appointDatetime = datetime; asvm.scheduledatas = result; } else if (type == "next") { DateTime nextDate = datetime.Value.AddDays(1); result = scheduledataRepo.Get().Where(a => a.IsDeleted != true & a.AppointmentDatetime.Value.Day == nextDate.Day && a.HospitalID == hospitalid).ToList(); asvm.appointDatetime = nextDate; asvm.scheduledatas = result; } else { DateTime prevDate = datetime.Value.AddDays(-1); result = scheduledataRepo.Get().Where(a => a.IsDeleted != true & a.AppointmentDatetime.Value.Day == prevDate.Day && a.HospitalID == hospitalid).ToList(); asvm.appointDatetime = prevDate; asvm.scheduledatas = result; } return(request.CreateResponse <AppointScheduleViewModel>(HttpStatusCode.OK, asvm)); }
public HttpResponseMessage ScheduleDelete(HttpRequestMessage request, int ID) { tbScheduleData UpdatedEntity = new tbScheduleData(); tbScheduleData schedule = scheduleRepo.Get().Where(a => a.ID == ID).FirstOrDefault(); schedule.IsDeleted = true; UpdatedEntity = scheduleRepo.UpdatewithObj(schedule); return(request.CreateResponse <tbScheduleData>(HttpStatusCode.OK, UpdatedEntity)); }
public ScheduleListViewModel() { ScheduleDataRepository sdr = new ScheduleDataRepository(); IEnumerable <Schedule> schedules = sdr.Get(); Schedules = new ObservableCollection <Schedule>(); }
public HttpResponseMessage stopAppointment(HttpRequestMessage request, int doctorid, int hospitalid, DateTime AppointmentDatetime) { tbScheduleData scheduleData = scheduleDataRepo.Get().Where(a => a.DoctorID == doctorid && a.HospitalID == hospitalid && a.AppointmentDatetime == AppointmentDatetime && a.IsDeleted != true).FirstOrDefault(); scheduleData.MaxPatientCount = scheduleData.ReachedPatientCount; scheduleData.IsStopped = true; scheduleData = scheduleDataRepo.UpdatewithObj(scheduleData); if (scheduleData != null) { return(request.CreateResponse <string>(HttpStatusCode.OK, "S001")); } else { return(request.CreateResponse <string>(HttpStatusCode.OK, "E001")); } }