Example #1
0
        public HttpResponseMessage UpsertSchedule(HttpRequestMessage request, tbScheduleData schedule)
        {
            string date     = schedule.AppointmentDatetime.Value.ToShortDateString();
            string fromtime = schedule.Fromtime.Value.ToShortTimeString();
            string totime   = schedule.Totime.Value.ToShortTimeString();

            fromtime = date + " " + fromtime;
            totime   = date + " " + totime;
            DateTime fromtimedate = DateTime.Parse(fromtime);
            DateTime totimedate   = DateTime.Parse(totime);

            tbScheduleData UpdatedEntity = null;

            if (schedule.ID > 0)
            {
                schedule.Fromtime            = fromtimedate;
                schedule.Totime              = totimedate;
                schedule.AppointmentDatetime = fromtimedate;
                UpdatedEntity = scheduledataRepo.UpdatewithObj(schedule);
            }
            else
            {
                schedule.IsDeleted           = false;
                schedule.Fromtime            = fromtimedate;
                schedule.Totime              = totimedate;
                schedule.AppointmentDatetime = fromtimedate;
                UpdatedEntity = scheduledataRepo.AddWithGetObj(schedule);
            }
            return(request.CreateResponse <tbScheduleData>(HttpStatusCode.OK, UpdatedEntity));
        }
Example #2
0
        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"));
            }
        }
        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));
        }