public ActionResult Appointment(AppointmentRecords appointmodel) { using (IPHISEntities dbmodel = new IPHISEntities()) { Appointment appointmodel1 = new Appointment(); appointmodel1.DoctorId = appointmodel.DoctorId; appointmodel1.HospitalId = appointmodel.HospitalId; appointmodel1.AppointmentDate = appointmodel.AppointmentDate; appointmodel1.StartTime = appointmodel.StartTime; appointmodel1.EndTime = appointmodel.EndTime; appointmodel1.ProblemId = appointmodel.ProblemId; dbmodel.Appointments.Add(appointmodel1); try { dbmodel.SaveChanges(); } catch (DbEntityValidationException e) { Console.WriteLine(e); } } ModelState.Clear(); ViewBag.SuccessMessage = "Appointment Booked Successfully.Confirmation Mail Will Be Sent To You Shortly."; return(View("Appointment", new AppointmentRecords())); }
// GET: Doctor public ActionResult Default_D(AppointmentRecords ur) { string mainconn = ConfigurationManager.ConnectionStrings["Myconn"].ConnectionString; SqlConnection sqlconn = new SqlConnection(mainconn); string s1 = "SELECT * FROM [dbo].[Appointment]"; SqlCommand sqlcomm = new SqlCommand(s1); sqlcomm.Connection = sqlconn; sqlconn.Open(); SqlDataReader sdr = sqlcomm.ExecuteReader(); List <AppointmentRecords> objmodel = new List <AppointmentRecords>(); if (sdr.HasRows) { while (sdr.Read()) { var details = new AppointmentRecords(); details.AppointmentId = Convert.ToInt32(Request["Appointment Id"]); details.UserId = Convert.ToInt32(Request["User Id"]); //details.User = Convert.ToInt32(Request["User Id"]); details.AppointmentDate = Convert.ToDateTime(Request["Appointment Date"]); //details.AppointmentStatus = sdr["Appointment Status"].ToString(); details.ProblemId = Convert.ToInt32(Request["Problem Id"]); //details.StartTime = Convert.ToTimeSpan(Request["Start Time"]); //details.EndTime = Convert.ToTimeSpan(Request["End Time"]); details.PaymentId = Convert.ToInt32(Request["Payment Id"]); objmodel.Add(details); } ur.appointmentinfo = objmodel; sqlconn.Close(); } return(View("Default_D", ur)); }
public ActionResult Appointment(int id = 0) { AppointmentRecords appointmodel = new AppointmentRecords(); using (IPHISEntities dbmodel = new IPHISEntities()) { } return(View(appointmodel)); }