Beispiel #1
0
 public JsonResult SaveAppointment(Appointment model)
 {
     if (model.AppointmentDate <= DateTime.Now)
     {
         return(new JsonResult {
             Data = new { Status = "Fail", msg = "Appointment date should be greater than today." }, JsonRequestBehavior = JsonRequestBehavior.AllowGet
         });
     }
     else
     {
         model.PatientNo = model.PatientNo.Split('(')[0];
         model.StartTime = Convert.ToDateTime(model.SelectedSlot.StartTime);
         model.EndTime   = Convert.ToDateTime(model.SelectedSlot.EndTime);
         string id    = _doctorService.AddAppointment(model);
         Thread email = new Thread(delegate() {
             sendEmail(_doctorService.getAppointmentById(Convert.ToInt32(id)));
         });
         email.IsBackground = true;
         email.Start();
         return(new JsonResult {
             Data = new { Status = "Success", msg = "Your appointment has been booked." }, JsonRequestBehavior = JsonRequestBehavior.AllowGet
         });
     }
 }