Agenda
- What we are going to build
- What we are going to use
- Application Structure
- Domain Entities
- Conclusion
https://media.giphy.com/media/ftdVYbwhSiR8woVjGZ/giphy.gif
What we are going to build?
We are going to build a clinic management project to support the requirement of a clinic I named Tayo Clinic. Here is the basic concept -
Patients visit the clinic and get registered. In the patient form, we can collect the patient's information, such as - name gender, birthdate, height, weight, phone, address, and city.
Then, they make an appointment by selecting the populated list of available doctors which, in turn, lists the upcoming appointments for the selected doctor. By default, the appointment gets a pending status because it needs to be reviewed.
The patient detail view is shown below where we can add the appointments (admin) and the attendances (doctor); we also display them using bootstrap modals and badges.

After that, the doctor is going to fill out the attendance form. In this form, we will collect the diagnosis, therapy, and clinic remarks.
In the patient's history, we have a view decorated with data tables.
In the Report section, we have reports of appointments, attendance, and diagnosis.
Appointment report
Attendance report
Accounts
There are two users; administrators and doctors.
Admin has full application access including adding a new patient and assigning him/her to an available doctor.
The doctor is registered first by an administrator and has a view that displays the patients assigned to him.
What we are going to use?
Server-side
- Asp.net MVC, a web application development framework
- Entity Framework an ORM for accessing data.
- Ninject for inversion of control container to resolve dependencies.
- Automapper for mapping domain entities to DTOs.
Front End
- Bootstrap 3
- Jquery Datatables
- Bootbox js
Design template
Application structure
All persistence ignorant parts are in the Core folder; these are domain entities, DTOs, View models, and interfaces. The Persistence folder contains entity configurations and the implementation of repository interfaces.
Domain Entities
The patient has information such as a token (auto-generated serial number), name, phone, and Age (derived from birthdate). A patient will have one or more appointments or attendance, so we need to add a collection of appointments and attendances.
public class Patient
{
public int Id { get; set; }
public string Token { get; set; }
public string Name { get; set; }
public Gender Sex { get; set; }
public DateTime BirthDate { get; set; }
public string Phone { get; set; }
public string Address { get; set; }
public byte CityId { get; set; }
public City Cities { get; set; }
public DateTime DateTime { get; set; }
public string Height { get; set; }
public string Weight { get; set; }
public int Age
{
get
{
var now = DateTime.Today;
var age = now.Year - BirthDate.Year;
if (BirthDate > now.AddYears(-age)) age--;
return age;
}
}
public ICollection<Appointment> Appointments { get; set; }
public ICollection<Attendance> Attendances { get; set; }
public Patient()
{
Appointments = new Collection<Appointment>();
Attendances = new Collection<Attendance>();
}
}
Appointment has date time, details, and status (approved or pending).
public class Appointment
{
public int Id { get; set; }
public DateTime StartDateTime { get; set; }
public string Detail { get; set; }
public bool Status { get; set; }
public int PatientId { get; set; }
public Patient Patient { get; set; }
public int DoctorId { get; set; }
public Doctor Doctor { get; set; }
}
Each attendance has information such as diagnosis, therapy, and clinic remarks. It also has references to specific patients.
public class Attendance
{
public int Id { get; set; }
public string ClinicRemarks { get; set; }
public string Diagnosis { get; set; }
public string SecondDiagnosis { get; set; }
public string ThirdDiagnosis { get; set; }
public string Therapy { get; set; }
public DateTime Date { get; set; }
public int PatientId { get; set; }
public Patient Patient { get; set; }
}
Each doctor has one or more appointments and has also a reference to a specific specialization.
public class Doctor
{
public int Id { get; set; }
public string Name { get; set; }
public string Phone { get; set; }
public bool IsAvailable { get; set; }
public string Address { get; set; }
public int SpecializationId { get; set; }
public Specialization Specialization { get; set; }
public string PhysicianId { get; set; }
public ApplicationUser Physician { get; set; }
public ICollection<Appointment> Appointments { get; set; }
public Doctor()
{
Appointments = new Collection<Appointment>();
}
}
Conclusion
That’s it, I hope this post is useful for beginners. You can get the source code from here

tara rainePosted Apr 9, 2023, 5:57 PM
When i run " update-database" i get this error "Une erreur li?e au r?seau ou sp?cifique ? l'instance s'est produite lors de l'?tablissement d'une connexion ? SQL Server. Le serveur est introuvable ou n'est pas accessible. V?rifiez que le nom de l'instance est correct et que SQL Server est configur? pour autoriser les connexions distantes. (provider: SQL Network Interfaces, error: 26 - Erreur lors de la localisation du serveur/de l'instance sp?cifi?s)"
Lakshmesh LakshmeshPosted Jun 10, 2022, 7:26 PM
How to run this project?
Zä IB MäĺįķPosted Dec 20, 2021, 3:23 PM
Where is the link of githu repo?
ShivaPosted May 25, 2021, 5:35 PM
Hi, Couldn't get drop down list for city on add patient and specialisation on add doctors. Please do direct me
EL ninoPosted Nov 15, 2020, 7:14 AM
It seems like my Visual studio can't find any project or solution file in all the folders to execute. How can I work around this please..anybody
Pooja KPosted Oct 22, 2020, 2:15 PM
In Visual Studio Tools, Nuget Package Manager, open Package Manager Tools and execute the below commands enable-migrations add-migration "InitialDb" update-database
Pooja KPosted Oct 22, 2020, 2:11 PM
Create DB ClinicDB in sqlserver and add the db details in web.config.
anirudh pandeyPosted Jun 16, 2020, 11:42 AM
Sir Please Help enable-migrationsenable-migrations: The term 'enable-migrations' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + enable-migrations + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (enable-migrations:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Arwa ShaqourPosted Jun 16, 2020, 5:12 AM
Could you please send us the database ... thanks in advance
Arwa ShaqourPosted Jun 16, 2020, 2:20 AM
Hi Ahmed ... Could you please help me in running the code ?? I couldn't run it :(
sethu srinivasPosted Jun 13, 2020, 7:20 AM
Please add database to easy or learners Ahmed if you have...
sethu srinivasPosted Jun 6, 2020, 6:05 AM
With out database we can't run application please provide database.
Aasli SanjuPosted Apr 19, 2020, 11:48 PM
Could not load type 'ClinicManagement.MvcApplication'
Osama AbdelazizPosted Mar 6, 2020, 9:47 AM
Error No parameterless constructor defined for this object.
Thái Đặng VănPosted Feb 27, 2020, 3:39 AM
Is there a part on how to run cards?
Prashant SankpalPosted Jan 22, 2020, 10:23 AM
Please do provide the database
ansh randhawaPosted Dec 31, 2019, 12:58 AM
Please do provide the database
sonal malhotraPosted Dec 11, 2019, 3:14 AM
In which version u installed ninject mvc ? i have issue
meet patelPosted Nov 18, 2019, 12:07 PM
Hello sir there is a error of sql connection i am using VS2019 and when i run "update-database" so much of error they are showing. They mentioned that "server was not found or not accessible".. what can i do please reply as soon as possible sir!! thank you so much
aaa taaaPosted Sep 24, 2019, 11:09 AM
Hi do you have .NET MVC source code for expense claim management system
sdfgsfdgfg asdfgsfgPosted Aug 1, 2019, 5:14 AM
Hello sir where is DB please help me
Abhishek SinghPosted Apr 19, 2019, 6:12 AM
Sir it is really awesome sir i need a project to submit in college plz if u hv any so share it to my email, it's urgent sir
Tapan AcharyaPosted Apr 3, 2019, 6:51 AM
I am not able to add-migration "InitialDb" command. Then If I run update-database command, it gives me can't attach the .mdf file error.
Mladen RADICPosted Mar 14, 2019, 2:57 PM
Great! Thx Ahmed :)
Pritesh NimjePosted Feb 4, 2019, 5:04 AM
Issue: cant login even after adding admin
Hamid KhanPosted Feb 4, 2019, 4:13 AM
Good work done by you. Thanks alot..............
bhagwant singhPosted Jan 28, 2019, 12:05 AM
Hi Ahmed thanks for such a nice artical . I did not found DB Script will you please tell me where will i found DB Script.
Amit GhoshPosted Jan 27, 2019, 5:01 AM
Facing this error for Entity framework update database any solution ? The object 'DF__Prescript__Medic__3B75D760' is dependent on column 'Medicine'.ALTER TABLE ALTER COLUMN Medicine failed because one or more objects access this column
Hashmatullah esmatPosted Jan 25, 2019, 11:13 AM
Thank you for posting this Article. I downloaded the file and while running it, i am getting this error " Could not find a part of the path 'ClinicManagement-master\ClinicManagement\bin\roslyn\csc.exe'.". Can you please upload the Database also?
Arifullah IrfannPosted Jan 25, 2019, 10:31 AM
Nice work But there is no user in database to login
Amit GhoshPosted Jan 25, 2019, 4:33 AM
When am running EF migration showing error The object 'DF__Prescript__Medic__1F98B2C1' is dependent on column 'Medicine'.ALTER TABLE ALTER COLUMN Medicine failed because one or more objects access this column
ajay gardePosted Jan 24, 2019, 11:46 AM
Where is database for this ??