public ActionResult Index() { DoctorBill doctorBill = new DoctorBill() { getAllDoctorsName = doctorPortal.getAllDoctorsName(), getAllPatientsName = patientPortal.getAllPatientsName(), getAllVisitBills = doctorBillPortal.getAllVisitBills() }; return(View(doctorBill)); }
public void insert(DoctorBill doctorBill) { using (SqlConnection conn = new SqlConnection(cs)) { string query = "insert into doctor_bill values(@p_id,@d_id,@visit_bill,@days,@total_bill)"; SqlCommand sqlCommand = new SqlCommand(query, conn); sqlCommand.Parameters.AddWithValue("@p_id", doctorBill.p_id); sqlCommand.Parameters.AddWithValue("@d_id", doctorBill.d_id); sqlCommand.Parameters.AddWithValue("@visit_bill", doctorBill.visit_bill); sqlCommand.Parameters.AddWithValue("@days", doctorBill.days); sqlCommand.Parameters.AddWithValue("@total_bill", doctorBill.total_bill); conn.Open(); sqlCommand.ExecuteNonQuery(); } }
public ActionResult Create(FormCollection collection) { DoctorBill doctorBill = new DoctorBill { p_id = Convert.ToInt32(collection["p_id"]), d_id = Convert.ToInt32(collection["d_id"]), visit_bill = Convert.ToInt32(collection["visit_bill"]), days = Convert.ToInt32(collection["days"]) }; doctorBill.total_bill = doctorBill.visit_bill * doctorBill.days; DoctorBillPortal doctorBillPortal = new DoctorBillPortal(); doctorBillPortal.insert(doctorBill); return(RedirectToAction("Index")); }