Question: I am needing some help as far as steps 4, 6, and 7 go. Here are the instructions along with the work I have done
I am needing some help as far as steps 4, 6, and 7 go. Here are the instructions along with the work I have done so far. Thank you in advance, will upvote!
Instructions:
The app should be a console app with Entity Framework Core using a SQLite database.
3. Create a model to store the patients first name, last name, age, gender, admittance date, and whether or not they have had an examination with the doctor. Use the appropriate data types.
4. User should be able to **add** a new patient along with all the information from step 3 to the database. Put this functionality in a method in a separate class that you call. See below for instructions.
5. User should be able to **list** all patients. This should print out every patient and their information to the console. Put this functionality in a method in the same class as above.
6. User should be able to **update** a patient record and change any of their information from step 3. Put this code in a method/class like above.
7. User should be able to **remove** a patient from the database. Put this code in a method/class like above.
8. You do not need to validate user input...yet.
9. The following patient records should already be stored in the database at the start:
| First Name | Last Name | Age | Gender | Admit Date | Had Exam? |
| Roxie | Hart | 34 | F | 5/28/1924 | Y |
| Grace | Bertrand | 24 | F | 1/15/1939 | Y |
| Harold | Hill | 52 | M | 7/1/1943 | N |
| Herman | Dietrich | 47 | M | 9/12/1936 | Y |
## Class to store methods for database access
It is often useful to create separate methods to store code that could be used often. You can write that code once and then invoke or call it whenever needed. With OOP we will create a new class that will store all related methods. We can then instantiate an object of that class and use its methods in `Program.cs`.
Our methods will all involve accessing the database - in particular a hospital database. We want behavior to add patients, list patients, update patients, and remove patients. Here are the steps I recommend.
1. Create a new file called `Hospital.cs`. This is not part of the data model, but it accesses the data model. Place this file in your top-level directory with `Program.cs`
2. Start with the following template and then fill in the methods to complete the assignment:
```
using System;
namespace Homework2 // You may have to change the namespace to match that of your Model
{
public class Hospital
{
public void SeedDatabase()
{
// Place your code here for Task 9 - seed the database
}
public void ListPatients()
{
// Place your code here for Task 5 - list patients
}
public void AddPatient()
{
// Place your code here for Task 4 - add a patient
}
public void UpdatePatient()
{
// Place your code here for Task 6 - update a patient
}
public void RemovePatient()
{
// Place your code here for Task 7 - remove a patient
}
}
}
```
3. In `Program.cs` create a Hospital object with the `new` keyword and use the dot operator to call the methods as needed. Refer back to Lab 2.
And here is my work so far:




Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
