//function to ask first for confirmation whether to delete a particular patient or not public ActionResult DeleteConfirm(int id) { Debug.WriteLine("i am asking confirmation of patients id : " + id + "to delete"); //query to select a particular patient to delete string query = "select * from PatientsRegistration where id=@id"; SqlParameter param = new SqlParameter("@id", id); PatientsRegistration selectedpatient = db.PatientsRegistration.SqlQuery(query, param).FirstOrDefault(); return(View(selectedpatient)); }
//Displaying the previously added record of patient in respective fields public ActionResult Edit(int id) { Debug.WriteLine("I am pulling prevoiusly added content of Patients with ID:" + id); //query to get all the details of patients from table with respective id of patient string query = "select * from PatientsRegistration where id = @id"; var parameter = new SqlParameter("@id", id); PatientsRegistration selectedpatient = db.PatientsRegistration.SqlQuery(query, parameter).FirstOrDefault(); //returning view of a selected patient to display data in respective fields on edit page of patient return(View(selectedpatient)); }
// Showing details of patient public ActionResult Show(int id) { Debug.WriteLine(" I am getting details of Patients with id:" + id); //writing query to select a particular patient string query = "select * from PatientsRegistration where id =@id"; var parameter = new SqlParameter("@id", id); PatientsRegistration selectedpatient = db.PatientsRegistration.SqlQuery(query, parameter).FirstOrDefault(); //returning records of a specific patient return(View(selectedpatient)); }