public AvailDoctor TimeAvalOfDoc() { using (var bookpro = new BookingRepository()) { AvailDoctor av = new AvailDoctor(); try { var z = bookpro.GetAll().Last(x => x.bookingStatus.Equals("Booked")); av.id = z.BookingId; av.from = z.Time_start; av.to = z.Time_end; } catch { // var z = bookpro.GetAll().Last(x => x.bookingStatus.Equals("Booked")); av.id = 1; av.from = "2000, 8, 13"; av.to = "2000, 9, 13"; } // var z = bookpro.GetAll().Last(x => x.bookingStatus.Equals("Booked")); return(av); } }
public void saveDoctorAv(AvailDoctor m) { DateTime form = Convert.ToDateTime(m.from); DateTime to = form.AddDays(Convert.ToDouble(m.num)); string end_date = to.ToString().Substring(8, 2) + "/" + to.ToString().Substring(5, 2) + "/" + to.ToString().Substring(0, 4); using (var bookpro = new BookingRepository()) { Booking _b = new Booking(); _b.BookingId = m.id; _b.PatientFullName = "Doctor"; _b.PatientIdKey = 0; _b.notificationStatus = false; _b.PatientID = "1547899655"; _b.Telephone = "0781787520"; _b.Time_start = m.from; _b.Time_end = end_date; _b.bookingStatus = "Doctor"; bookpro.Insert(_b); } }
public ActionResult DoctorTime(AvailDoctor m) { b.saveDoctorAv(m); //b.CreateReservation(m); return(RedirectToAction("Index", "Calendar")); }