/// <summary> /// Deprecated Method for adding a new object to the Patients EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPatients(Patient patient) { base.AddObject("Patients", patient); }
public ActionResult NewPatient(Patient pt) { if (ModelState.IsValid) { string insert_string = "INSERT INTO Patient (originalID,sex,age,entryDate,surgeonID) VALUES (@p1,@p2,@p3,CURRENT_TIMESTAMP,@p4);"; //insert statement SqlConnection db = new SqlConnection(@"Data Source="",1044;Initial Catalog="";User ID="";Password="""); SqlCommand command = new SqlCommand(insert_string, db); command.Parameters.AddWithValue("@p1", pt.originalID); command.Parameters.AddWithValue("@p2", pt.sex); command.Parameters.AddWithValue("@p3", pt.age); command.Parameters.AddWithValue("@p4", Session["surgeonID"].ToString()); db.Open(); command.ExecuteNonQuery(); db.Close(); AuditController.CreateAuditEntry(Session["userID"].ToString(), Session["username"].ToString(), "Patient", null, "Insert"); } return View(); }
/// <summary> /// Create a new Patient object. /// </summary> /// <param name="patientID">Initial value of the patientID property.</param> public static Patient CreatePatient(global::System.Int32 patientID) { Patient patient = new Patient(); patient.patientID = patientID; return patient; }
public ActionResult NewPatient() { var model = new Patient(); return View(); }