Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
Medic
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hasan.bahjat
Medic
Commits
5f496869
Commit
5f496869
authored
Jun 01, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update f
parent
2aeaaeea
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
214 additions
and
99 deletions
+214
-99
Category.cs
ApplicationCore/Entities/Medicines/Category.cs
+0
-0
Ingredient.cs
ApplicationCore/Entities/Medicines/Ingredient.cs
+0
-0
Medicine.cs
ApplicationCore/Entities/Medicines/Medicine.cs
+11
-4
MedicineIngredient.cs
ApplicationCore/Entities/Medicines/MedicineIngredient.cs
+0
-0
MedicineType.cs
ApplicationCore/Entities/Medicines/MedicineType.cs
+0
-0
MedicalState.cs
ApplicationCore/Entities/Patients/MedicalState.cs
+20
-0
MedicalStateMedicine.cs
ApplicationCore/Entities/Patients/MedicalStateMedicine.cs
+19
-0
Patient.cs
ApplicationCore/Entities/Patients/Patient.cs
+6
-3
PatientMedicine.cs
ApplicationCore/Entities/Patients/PatientMedicine.cs
+0
-0
IPatientService.cs
ApplicationCore/Interfaces/IServices/IPatientService.cs
+5
-5
PatientService.cs
ApplicationCore/Services/PatientService/PatientService.cs
+22
-24
MedicalStateSpecification.cs
ApplicationCore/Specification/MedicalStateSpecification.cs
+28
-0
MedicineIngredientSpecification.cs
...tionCore/Specification/MedicineIngredientSpecification.cs
+1
-1
PatientMedicinesSpecification.cs
...cationCore/Specification/PatientMedicinesSpecification.cs
+3
-2
MedicDbContext.cs
Infrastructure/Data/MedicDbContext.cs
+52
-19
HomeController.cs
WebPresentation/Controllers/HomeController.cs
+16
-17
MedicineController.cs
WebPresentation/Controllers/MedicineController.cs
+2
-1
Index.cshtml
WebPresentation/Views/Home/Index.cshtml
+15
-16
MedicalStateDetails.cshtml
WebPresentation/Views/Home/MedicalStateDetails.cshtml
+4
-4
Create.cshtml
WebPresentation/Views/Medicine/Create.cshtml
+10
-3
WebPresentation.csproj.AssemblyReference.cache
...bug/net5.0/WebPresentation.csproj.AssemblyReference.cache
+0
-0
No files found.
ApplicationCore/Entities/Category.cs
→
ApplicationCore/Entities/
Medicines/
Category.cs
View file @
5f496869
File moved
ApplicationCore/Entities/Ingredient.cs
→
ApplicationCore/Entities/
Medicines/
Ingredient.cs
View file @
5f496869
File moved
ApplicationCore/Entities/Medicine.cs
→
ApplicationCore/Entities/Medicine
s/Medicine
.cs
View file @
5f496869
...
@@ -8,17 +8,24 @@ namespace ApplicationCore.Entities
...
@@ -8,17 +8,24 @@ namespace ApplicationCore.Entities
{
{
public
class
Medicine
:
EntityBase
public
class
Medicine
:
EntityBase
{
{
public
String
Name
{
get
;
set
;
}
public
String
TradeName
{
get
;
set
;
}
public
String
ScintificName
{
get
;
set
;
}
public
String
ManufactureName
{
get
;
set
;
}
public
String
SideEffect
{
get
;
set
;
}
public
String
Description
{
get
;
set
;
}
public
String
Description
{
get
;
set
;
}
public
int
Price
{
get
;
set
;
}
public
int
Price
{
get
;
set
;
}
public
String
Image
{
get
;
set
;
}
public
String
Image
{
get
;
set
;
}
public
int
Dosage
{
get
;
set
;
}
public
int
Dosage
{
get
;
set
;
}
public
Category
Category
{
get
;
set
;
}
public
Category
Category
{
get
;
set
;
}
public
MedicineType
MedicineType
{
get
;
set
;
}
public
MedicineType
MedicineType
{
get
;
set
;
}
#
region
Relations
public
ICollection
<
Ingredient
>
Ingredients
{
get
;
set
;
}
public
ICollection
<
Ingredient
>
Ingredients
{
get
;
set
;
}
//public ICollection<Patient> Patients { get; set; }
public
ICollection
<
MedicalState
>
MedicalStates
{
get
;
set
;
}
public
ICollection
<
MedicalStateMedicine
>
MedicalStateMedicines
{
get
;
set
;
}
public
ICollection
<
MedicineIngredient
>
MedicineIngredients
{
get
;
set
;
}
public
ICollection
<
MedicineIngredient
>
MedicineIngredients
{
get
;
set
;
}
public
ICollection
<
Patient
>
Patients
{
get
;
set
;
}
// public ICollection<PatientMedicine> PatientMedicines { get; set; }
public
ICollection
<
PatientMedicine
>
PatientMedicines
{
get
;
set
;
}
public
void
AddIngredient
(
Ingredient
ingredient
,
int
ratio
)
{
public
void
AddIngredient
(
Ingredient
ingredient
,
int
ratio
)
{
MedicineIngredients
.
Add
(
MedicineIngredients
.
Add
(
...
@@ -31,7 +38,7 @@ namespace ApplicationCore.Entities
...
@@ -31,7 +38,7 @@ namespace ApplicationCore.Entities
}
}
#
endregion
Relations
}
}
}
}
ApplicationCore/Entities/MedicineIngredient.cs
→
ApplicationCore/Entities/Medicine
s/Medicine
Ingredient.cs
View file @
5f496869
File moved
ApplicationCore/Entities/MedicineType.cs
→
ApplicationCore/Entities/Medicine
s/Medicine
Type.cs
View file @
5f496869
File moved
ApplicationCore/Entities/Patients/MedicalState.cs
0 → 100644
View file @
5f496869
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
ApplicationCore.Entities
{
public
class
MedicalState
:
EntityBase
{
public
int
PatientId
{
get
;
set
;
}
public
Patient
Patient
{
get
;
set
;
}
public
String
StateName
{
get
;
set
;
}
public
String
StateDescription
{
get
;
set
;
}
public
DateTime
PrescriptionTime
{
get
;
set
;
}
public
ICollection
<
Medicine
>
Medicines
{
get
;
set
;
}
public
ICollection
<
MedicalStateMedicine
>
MedicalStateMedicines
{
get
;
set
;
}
}
}
ApplicationCore/Entities/Patients/MedicalStateMedicine.cs
0 → 100644
View file @
5f496869
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
ApplicationCore.Entities
{
public
class
MedicalStateMedicine
:
EntityBase
{
public
int
MedicineId
{
get
;
set
;
}
public
int
MedicalStateId
{
get
;
set
;
}
#
region
Navigation
public
Medicine
Medicine
{
get
;
set
;
}
public
MedicalState
MedicalState
{
get
;
set
;
}
#
endregion
Navigation
}
}
ApplicationCore/Entities/Patient.cs
→
ApplicationCore/Entities/Patient
s/Patient
.cs
View file @
5f496869
...
@@ -13,8 +13,11 @@ namespace ApplicationCore.Entities
...
@@ -13,8 +13,11 @@ namespace ApplicationCore.Entities
public
String
UserId
{
get
;
set
;
}
public
String
UserId
{
get
;
set
;
}
public
User
User
{
get
;
set
;
}
public
User
User
{
get
;
set
;
}
public
String
BIO
{
get
;
set
;
}
public
String
BIO
{
get
;
set
;
}
public
ICollection
<
Medicine
>
Medicines
{
get
;
set
;
}
public
ICollection
<
PatientMedicine
>
PatientMedicines
{
get
;
set
;
}
#
region
Relations
public
ICollection
<
MedicalState
>
MedicalStates
{
get
;
set
;
}
// public ICollection<Medicine> Medicines { get; set; }
// public ICollection<PatientMedicine> PatientMedicines { get; set; }
#
endregion
Relations
}
}
}
}
ApplicationCore/Entities/PatientMedicine.cs
→
ApplicationCore/Entities/Patient
s/Patient
Medicine.cs
View file @
5f496869
File moved
ApplicationCore/Interfaces/IServices/IPatientService.cs
View file @
5f496869
...
@@ -11,13 +11,13 @@ namespace ApplicationCore.Interfaces.IServices
...
@@ -11,13 +11,13 @@ namespace ApplicationCore.Interfaces.IServices
public
interface
IPatientService
public
interface
IPatientService
{
{
public
IEnumerable
<
Medic
ine
>
GetPatientMedicin
es
(
int
patientId
);
public
IEnumerable
<
Medic
alState
>
GetPatientMedicalStat
es
(
int
patientId
);
public
Medic
ine
GetMedicineDetails
(
int
id
,
params
Expression
<
Func
<
Medicin
e
,
object
>>[]
includeProperties
);
public
Medic
alState
GetMedicalStateDetails
(
int
id
,
params
Expression
<
Func
<
MedicalStat
e
,
object
>>[]
includeProperties
);
public
IEnumerable
<
Patient
>
GetAll
(
params
Expression
<
Func
<
Patient
,
object
>>[]
includeProperties
);
public
IEnumerable
<
Patient
>
GetAll
(
params
Expression
<
Func
<
Patient
,
object
>>[]
includeProperties
);
public
void
AddMedic
ine
(
int
patientId
,
Medicine
medicin
e
);
public
void
AddMedic
alState
(
int
patientId
,
MedicalState
medicalStat
e
);
public
Patient
GetById
(
int
id
,
params
Expression
<
Func
<
Patient
,
object
>>[]
includeProperties
);
public
Patient
GetById
(
int
id
,
params
Expression
<
Func
<
Patient
,
object
>>[]
includeProperties
);
public
void
Insert
(
Patient
owner
);
public
void
Insert
(
Patient
patient
);
public
void
Update
(
Patient
owner
);
public
void
Update
(
Patient
patient
);
public
void
Delete
(
int
id
);
public
void
Delete
(
int
id
);
public
bool
PatientExists
(
int
id
);
public
bool
PatientExists
(
int
id
);
...
...
ApplicationCore/Services/PatientService/PatientService.cs
View file @
5f496869
...
@@ -14,52 +14,50 @@ namespace ApplicationCore.Services.PatientService
...
@@ -14,52 +14,50 @@ namespace ApplicationCore.Services.PatientService
public
class
PatientService
:
IPatientService
public
class
PatientService
:
IPatientService
{
{
private
readonly
IUnitOfWork
<
Patient
>
_patientUnitOfWork
;
private
readonly
IUnitOfWork
<
Patient
>
_patientUnitOfWork
;
private
readonly
IUnitOfWork
<
Medic
ine
>
_medicin
eUnitOfWork
;
private
readonly
IUnitOfWork
<
Medic
alState
>
_medicalStat
eUnitOfWork
;
private
PatientMedicinesSpecification
_patientMedicinesSpecification
;
private
PatientMedicinesSpecification
_patientMedicinesSpecification
;
private
Medic
ineIngredientSpecification
_medicineIngredient
Specification
;
private
Medic
alStateSpecification
_medicalState
Specification
;
public
PatientService
(
IUnitOfWork
<
Patient
>
patientUnitOfWork
,
IUnitOfWork
<
Medicine
>
medicineUnitOfWork
)
public
PatientService
(
IUnitOfWork
<
Patient
>
patientUnitOfWork
,
IUnitOfWork
<
MedicalState
>
medicalStateUnitOfWork
)
{
{
_patientUnitOfWork
=
patientUnitOfWork
;
_patientUnitOfWork
=
patientUnitOfWork
;
_medic
ineUnitOfWork
=
medicin
eUnitOfWork
;
_medic
alStateUnitOfWork
=
medicalStat
eUnitOfWork
;
_patientMedicinesSpecification
=
new
PatientMedicinesSpecification
();
_patientMedicinesSpecification
=
new
PatientMedicinesSpecification
();
_medic
ineIngredientSpecification
=
new
MedicineIngredient
Specification
();
_medic
alStateSpecification
=
new
MedicalState
Specification
();
}
}
public
IEnumerable
<
Medic
ine
>
GetPatientMedicin
es
(
int
patientId
)
{
public
IEnumerable
<
Medic
alState
>
GetPatientMedicalStat
es
(
int
patientId
)
{
return
_patientUnitOfWork
.
Entity
return
_patientUnitOfWork
.
Entity
.
GetById
(
.
GetById
(
patientId
,
_patientMedicinesSpecification
patientId
,
_patientMedicinesSpecification
).
Medic
in
es
.
AsEnumerable
();
).
Medic
alStat
es
.
AsEnumerable
();
}
}
public
Medic
ine
GetMedicineDetails
(
int
id
,
params
Expression
<
Func
<
Medicin
e
,
object
>>[]
includeProperties
)
public
Medic
alState
GetMedicalStateDetails
(
int
id
,
params
Expression
<
Func
<
MedicalStat
e
,
object
>>[]
includeProperties
)
{
{
return
_medic
ineUnitOfWork
.
Entity
.
GetById
(
id
,
_medicineIngredient
Specification
);
return
_medic
alStateUnitOfWork
.
Entity
.
GetById
(
id
,
_medicalState
Specification
);
}
}
public
IEnumerable
<
Patient
>
GetAll
(
params
Expression
<
Func
<
Patient
,
object
>>[]
includeProperties
)
{
public
IEnumerable
<
Patient
>
GetAll
(
params
Expression
<
Func
<
Patient
,
object
>>[]
includeProperties
)
{
return
_patientUnitOfWork
.
Entity
.
GetAll
(
_patientMedicinesSpecification
);
return
_patientUnitOfWork
.
Entity
.
GetAll
(
_patientMedicinesSpecification
);
}
}
public
void
AddMedic
ine
(
int
patientId
,
Medicine
medicin
e
)
{
public
void
AddMedic
alState
(
int
patientId
,
MedicalState
medicalStat
e
)
{
var
ptient
=
_patientUnitOfWork
.
Entity
.
GetById
(
patientId
,
_patientMedicinesSpecification
);
var
ptient
=
_patientUnitOfWork
.
Entity
.
GetById
(
patientId
,
_patientMedicinesSpecification
);
if
(
medic
in
e
.
Id
!=
0
)
if
(
medic
alStat
e
.
Id
!=
0
)
foreach
(
var
i
in
ptient
.
Medic
in
es
)
foreach
(
var
i
in
ptient
.
Medic
alStat
es
)
{
{
if
(
i
.
Id
.
Equals
(
medic
in
e
.
Id
))
if
(
i
.
Id
.
Equals
(
medic
alStat
e
.
Id
))
return
;
return
;
}
}
ptient
.
PatientMedicines
ptient
.
MedicalStates
.
Add
(
new
PatientMedicine
{
.
Add
(
medicalState
Medicine
=
medicine
,
);
Patient
=
ptient
,
PrescripDate
=
DateTime
.
Now
});
_patientUnitOfWork
.
Entity
.
Update
(
ptient
);
_patientUnitOfWork
.
Entity
.
Update
(
ptient
);
_patientUnitOfWork
.
Save
();
_patientUnitOfWork
.
Save
();
}
}
...
@@ -68,19 +66,19 @@ namespace ApplicationCore.Services.PatientService
...
@@ -68,19 +66,19 @@ namespace ApplicationCore.Services.PatientService
return
_patientUnitOfWork
.
Entity
.
GetById
(
id
,
_patientMedicinesSpecification
);
return
_patientUnitOfWork
.
Entity
.
GetById
(
id
,
_patientMedicinesSpecification
);
}
}
public
void
Insert
(
Patient
owner
)
public
void
Insert
(
Patient
patient
)
{
{
_patientUnitOfWork
.
Entity
.
Insert
(
owner
);
_patientUnitOfWork
.
Entity
.
Insert
(
patient
);
_patientUnitOfWork
.
Save
();
_patientUnitOfWork
.
Save
();
}
}
public
void
Update
(
Patient
owner
)
public
void
Update
(
Patient
patient
)
{
{
_patientUnitOfWork
.
Entity
.
Update
(
owner
);
_patientUnitOfWork
.
Entity
.
Update
(
patient
);
_patientUnitOfWork
.
Save
();
_patientUnitOfWork
.
Save
();
}
}
public
void
Delete
(
int
id
)
public
void
Delete
(
int
id
)
...
...
ApplicationCore/Specification/MedicalStateSpecification.cs
0 → 100644
View file @
5f496869
using
ApplicationCore.Entities
;
using
ApplicationCore.Specification.BaseSpecification
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
ApplicationCore.Specification
{
class
MedicalStateSpecification
:
BaseSpecification
<
MedicalState
>
{
public
MedicalStateSpecification
()
{
AddInclude
(
p
=>
p
.
MedicalStateMedicines
);
AddInclude
(
p
=>
p
.
Medicines
);
AddInclude
(
p
=>
p
.
Patient
);
AddThenInclude
(
"MedicalStateMedicines.Medicine"
);
}
}
{
}
}
ApplicationCore/Specification/MedicineIngredientSpecification.cs
View file @
5f496869
...
@@ -17,7 +17,7 @@ namespace ApplicationCore.Specification
...
@@ -17,7 +17,7 @@ namespace ApplicationCore.Specification
AddInclude
(
p
=>
p
.
MedicineIngredients
);
AddInclude
(
p
=>
p
.
MedicineIngredients
);
AddInclude
(
p
=>
p
.
Category
);
AddInclude
(
p
=>
p
.
Category
);
AddInclude
(
p
=>
p
.
MedicineType
);
AddInclude
(
p
=>
p
.
MedicineType
);
AddInclude
(
p
=>
p
.
Patient
s
);
AddInclude
(
p
=>
p
.
MedicalState
s
);
AddInclude
(
p
=>
p
.
Ingredients
);
AddInclude
(
p
=>
p
.
Ingredients
);
AddThenInclude
(
"MedicineIngredients.Ingredient"
);
AddThenInclude
(
"MedicineIngredients.Ingredient"
);
...
...
ApplicationCore/Specification/PatientMedicinesSpecification.cs
View file @
5f496869
...
@@ -12,9 +12,10 @@ namespace ApplicationCore.Specification
...
@@ -12,9 +12,10 @@ namespace ApplicationCore.Specification
{
{
public
PatientMedicinesSpecification
()
public
PatientMedicinesSpecification
()
{
{
AddInclude
(
p
=>
p
.
Medic
in
es
);
AddInclude
(
p
=>
p
.
Medic
alStat
es
);
AddInclude
(
p
=>
p
.
User
);
AddInclude
(
p
=>
p
.
User
);
AddInclude
(
p
=>
p
.
PatientMedicines
);
AddThenInclude
(
"MedicalStates.Medicines"
);
}
}
...
...
Infrastructure/Data/MedicDbContext.cs
View file @
5f496869
...
@@ -23,6 +23,7 @@ namespace Infrastructure.Data
...
@@ -23,6 +23,7 @@ namespace Infrastructure.Data
public
DbSet
<
Ingredient
>
Ingredients
{
get
;
set
;
}
public
DbSet
<
Ingredient
>
Ingredients
{
get
;
set
;
}
public
DbSet
<
Category
>
Categories
{
get
;
set
;
}
public
DbSet
<
Category
>
Categories
{
get
;
set
;
}
public
DbSet
<
MedicineType
>
MedicineTypes
{
get
;
set
;
}
public
DbSet
<
MedicineType
>
MedicineTypes
{
get
;
set
;
}
public
DbSet
<
MedicalState
>
MedicalStates
{
get
;
set
;
}
protected
override
void
OnConfiguring
(
DbContextOptionsBuilder
optionsBuilder
)
protected
override
void
OnConfiguring
(
DbContextOptionsBuilder
optionsBuilder
)
{
{
...
@@ -49,17 +50,22 @@ namespace Infrastructure.Data
...
@@ -49,17 +50,22 @@ namespace Infrastructure.Data
);
);
modelBuilder
.
Entity
<
Patient
>()
modelBuilder
.
Entity
<
Patient
>()
.
HasMany
(
e
=>
e
.
MedicalStates
)
.
WithOne
(
e
=>
e
.
Patient
);
modelBuilder
.
Entity
<
MedicalState
>()
.
HasMany
(
e
=>
e
.
Medicines
)
.
HasMany
(
e
=>
e
.
Medicines
)
.
WithMany
(
e
=>
e
.
Patient
s
)
.
WithMany
(
e
=>
e
.
MedicalState
s
)
.
UsingEntity
<
Patient
Medicine
>(
.
UsingEntity
<
MedicalState
Medicine
>(
l
=>
l
.
HasOne
<
Medicine
>(
e
=>
e
.
Medicine
)
l
=>
l
.
HasOne
<
Medicine
>(
e
=>
e
.
Medicine
)
.
WithMany
(
e
=>
e
.
Patient
Medicines
)
.
WithMany
(
e
=>
e
.
MedicalState
Medicines
)
.
HasForeignKey
(
e
=>
e
.
MedicineId
),
.
HasForeignKey
(
e
=>
e
.
MedicineId
),
r
=>
r
.
HasOne
<
Patient
>(
e
=>
e
.
Patient
)
r
=>
r
.
HasOne
<
MedicalState
>(
e
=>
e
.
MedicalState
)
.
WithMany
(
e
=>
e
.
Patient
Medicines
)
.
WithMany
(
e
=>
e
.
MedicalState
Medicines
)
.
HasForeignKey
(
e
=>
e
.
Patient
Id
)
.
HasForeignKey
(
e
=>
e
.
MedicalState
Id
)
);
);
modelBuilder
.
Entity
<
Patient
>()
modelBuilder
.
Entity
<
Patient
>()
.
HasOne
(
o
=>
o
.
User
);
.
HasOne
(
o
=>
o
.
User
);
...
@@ -109,7 +115,7 @@ namespace Infrastructure.Data
...
@@ -109,7 +115,7 @@ namespace Infrastructure.Data
);
);
#
endregion
Roles
#
endregion
Roles
#
region
User
#
region
User
PasswordHasher
<
User
>
ph
=
new
PasswordHasher
<
User
>();
var
ph
=
new
PasswordHasher
<
Identity
User
>();
var
admin
=
new
User
var
admin
=
new
User
{
{
...
@@ -119,7 +125,8 @@ namespace Infrastructure.Data
...
@@ -119,7 +125,8 @@ namespace Infrastructure.Data
Avatar
=
"avatar.jpg"
,
Avatar
=
"avatar.jpg"
,
Email
=
"hasan@b"
,
Email
=
"hasan@b"
,
UserName
=
"Hasan.Bahjat"
,
UserName
=
"Hasan.Bahjat"
,
NormalizedEmail
=
"hasan@b"
,
PasswordHash
=
ph
.
HashPassword
(
null
,
"123@Aa"
),
NormalizedEmail
=
"hasan@b"
,
NormalizedUserName
=
"Hasan.Bahjat"
,
NormalizedUserName
=
"Hasan.Bahjat"
,
CreationTime
=
DateTime
.
Now
CreationTime
=
DateTime
.
Now
...
@@ -131,16 +138,14 @@ namespace Infrastructure.Data
...
@@ -131,16 +138,14 @@ namespace Infrastructure.Data
LastName
=
"Khaddour"
,
LastName
=
"Khaddour"
,
Avatar
=
"avatar1.jpg"
,
Avatar
=
"avatar1.jpg"
,
Email
=
"hasan.bahjat@mail.y"
,
Email
=
"hasan.bahjat@mail.y"
,
PasswordHash
=
ph
.
HashPassword
(
null
,
"123@Aa"
),
UserName
=
"Hasan.Khaddour"
,
UserName
=
"Hasan.Khaddour"
,
NormalizedEmail
=
"hasan@b"
,
NormalizedEmail
=
"hasan@b"
,
NormalizedUserName
=
"Hasan.khaddour"
,
NormalizedUserName
=
"Hasan.khaddour"
,
CreationTime
=
DateTime
.
Now
CreationTime
=
DateTime
.
Now
};
};
admin
.
PasswordHash
=
ph
.
HashPassword
(
admin
,
"123@Aa"
);
PatientAccount
.
PasswordHash
=
ph
.
HashPassword
(
PatientAccount
,
"123@Aa"
);
modelBuilder
.
Entity
<
User
>()
modelBuilder
.
Entity
<
User
>()
.
HasData
(
.
HasData
(
admin
,
admin
,
...
@@ -161,24 +166,52 @@ namespace Infrastructure.Data
...
@@ -161,24 +166,52 @@ namespace Infrastructure.Data
);
);
#
endregion
Patients
#
endregion
Patients
#
region
Categories
var
c1
=
new
Category
{
Id
=
1
,
Name
=
"Antibiotic"
};
var
c2
=
new
Category
{
Id
=
2
,
Name
=
"Painkiller"
};
modelBuilder
.
Entity
<
Category
>().
HasData
(
c1
,
c2
);
#
endregion
Categories
#
region
MedicineType
modelBuilder
.
Entity
<
MedicineType
>().
HasData
(
new
MedicineType
{
Id
=
1
,
TypeName
=
"Tablet"
},
new
MedicineType
{
Id
=
2
,
TypeName
=
"Syrup"
}
);
#
endregion
MedicineType
#
region
Ingredients
modelBuilder
.
Entity
<
Ingredient
>().
HasData
(
new
Ingredient
{
Id
=
1
,
Name
=
"Amoxicillin"
},
new
Ingredient
{
Id
=
2
,
Name
=
"Paracetamol"
}
);
modelBuilder
.
Entity
<
MedicineIngredient
>().
HasData
(
new
MedicineIngredient
{
MedicineId
=
1
,
IngredientId
=
1
},
new
MedicineIngredient
{
MedicineId
=
2
,
IngredientId
=
2
}
);
#
endregion
Ingredients
#
region
Medicines
#
region
Medicines
var
med
=
new
Medicine
var
med
=
new
Medicine
{
{
Id
=-
1
,
Id
=
1
,
Name
=
"Augmentine"
,
ScintificName
=
"Augmentine"
,
TradeName
=
"Augmentine"
,
ManufactureName
=
"Ibin Sina"
,
SideEffect
=
"No. "
,
Category
=
c1
,
Image
=
"med1.png"
,
Image
=
"med1.png"
,
Dosage
=
12
,
Dosage
=
12
,
Price
=
2500
,
Price
=
2500
,
};
};
var
c
=
new
Category
{
Id
=
1
,
Name
=
"Augmentine"
};
modelBuilder
.
Entity
<
Category
>().
HasData
(
c
);
// med.Category = c;
modelBuilder
.
Entity
<
Medicine
>().
HasData
(
med
);
modelBuilder
.
Entity
<
Medicine
>().
HasData
(
med
);
#
endregion
Medicines
#
endregion
Medicines
#
region
MedicalState
#
endregion
MedicalState
}
}
}
}
}
}
WebPresentation/Controllers/HomeController.cs
View file @
5f496869
...
@@ -21,14 +21,19 @@ namespace WebPresentation.Controllers
...
@@ -21,14 +21,19 @@ namespace WebPresentation.Controllers
{
{
private
readonly
PatientService
_patientService
;
private
readonly
PatientService
_patientService
;
private
readonly
MedicineService
_medicineService
;
private
readonly
MedicineService
_medicineService
;
private
readonly
UserManager
<
User
>
_userManager
;
private
readonly
UserManager
<
User
>
_userManager
;
public
HomeController
(
UserManager
<
User
>
userManager
,
IUnitOfWork
<
Patient
>
patientUnitOfWork
,
IUnitOfWork
<
Medicine
>
medicineUnitOfWork
):
base
(
userManager
)
public
HomeController
(
UserManager
<
User
>
userManager
,
IUnitOfWork
<
Patient
>
patientUnitOfWork
,
IUnitOfWork
<
Medicine
>
medicineUnitOfWork
,
IUnitOfWork
<
MedicalState
>
medicalStateUnitOfWork
):
base
(
userManager
)
{
{
_userManager
=
userManager
;
_userManager
=
userManager
;
_patientService
=
new
PatientService
(
patientUnitOfWork
,
medicineUnitOfWork
);
_medicineService
=
new
MedicineService
(
medicineUnitOfWork
);
_medicineService
=
new
MedicineService
(
medicineUnitOfWork
);
_patientService
=
new
PatientService
(
patientUnitOfWork
,
medicalStateUnitOfWork
);
}
}
...
@@ -39,9 +44,7 @@ namespace WebPresentation.Controllers
...
@@ -39,9 +44,7 @@ namespace WebPresentation.Controllers
var
ownesr
=
_patientService
var
ownesr
=
_patientService
.
GetAll
(
.
GetAll
(
u
=>
u
.
User
,
)
u
=>
u
.
Medicines
)
.
Where
(
.
Where
(
u
=>
u
.
User
.
Id
==
userId
u
=>
u
.
User
.
Id
==
userId
)
)
...
@@ -50,13 +53,9 @@ namespace WebPresentation.Controllers
...
@@ -50,13 +53,9 @@ namespace WebPresentation.Controllers
return
View
(
ownesr
);
return
View
(
ownesr
);
}
}
public
IActionResult
MedicineDetails
(
int
id
)
{
public
IActionResult
MedicalStateDetails
(
int
id
)
{
var
s
=
_patientService
.
GetMedicineDetails
(
var
s
=
_patientService
.
GetMedicalStateDetails
(
id
,
id
);
i
=>
i
.
MedicineIngredients
,
i
=>
i
.
Ingredients
,
i
=>
i
.
Category
,
i
=>
i
.
MedicineType
);
if
(
s
is
null
)
{
if
(
s
is
null
)
{
return
NotFound
();
return
NotFound
();
}
}
...
@@ -68,13 +67,13 @@ namespace WebPresentation.Controllers
...
@@ -68,13 +67,13 @@ namespace WebPresentation.Controllers
return
View
();
return
View
();
}
}
public
IActionResult
AddMedic
in
e
(
int
id
)
{
public
IActionResult
AddMedic
alStat
e
(
int
id
)
{
var
userId
=
_userManager
.
GetUserId
(
User
);
var
userId
=
_userManager
.
GetUserId
(
User
);
var
patient
=
_patientService
.
GetAll
(
u
=>
u
.
User
,
u
=>
u
.
Medicines
)
var
patient
=
_patientService
.
GetAll
()
.
Where
(
u
=>
u
.
User
.
Id
==
userId
).
FirstOrDefault
();
.
Where
(
u
=>
u
.
User
.
Id
==
userId
).
FirstOrDefault
();
var
m
=
_
medicineService
.
GetMedicin
eDetails
(
id
);
var
m
=
_
patientService
.
GetMedicalStat
eDetails
(
id
);
_patientService
.
AddMedic
in
e
(
patient
.
Id
,
m
);
_patientService
.
AddMedic
alStat
e
(
patient
.
Id
,
m
);
return
RedirectToAction
(
"Index"
,
"Home"
);
return
RedirectToAction
(
"Index"
,
"Home"
);
...
...
WebPresentation/Controllers/MedicineController.cs
View file @
5f496869
...
@@ -26,11 +26,12 @@ namespace WebPresentation.Controllers
...
@@ -26,11 +26,12 @@ namespace WebPresentation.Controllers
public
MedicineController
(
UserManager
<
User
>
userManager
,
public
MedicineController
(
UserManager
<
User
>
userManager
,
IUnitOfWork
<
Patient
>
patientUnitOfWork
,
IUnitOfWork
<
Patient
>
patientUnitOfWork
,
IUnitOfWork
<
Medicine
>
medicineUnitOfWork
,
IUnitOfWork
<
Medicine
>
medicineUnitOfWork
,
IUnitOfWork
<
MedicalState
>
medicalStateUnitOfWork
,
IUnitOfWork
<
Ingredient
>
ingredientUnitOfWork
):
base
(
userManager
)
IUnitOfWork
<
Ingredient
>
ingredientUnitOfWork
):
base
(
userManager
)
{
{
_ingredientService
=
new
IngredientService
(
ingredientUnitOfWork
);
_ingredientService
=
new
IngredientService
(
ingredientUnitOfWork
);
_medicineService
=
new
MedicineService
(
medicineUnitOfWork
);
_medicineService
=
new
MedicineService
(
medicineUnitOfWork
);
_patientService
=
new
PatientService
(
patientUnitOfWork
,
medic
in
eUnitOfWork
);
_patientService
=
new
PatientService
(
patientUnitOfWork
,
medic
alStat
eUnitOfWork
);
}
}
...
...
WebPresentation/Views/Home/Index.cshtml
View file @
5f496869
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
ViewData["userName"] = Model.User.FirstName + " " + Model.User.LastName;
ViewData["userName"] = Model.User.FirstName + " " + Model.User.LastName;
ViewBag.owner = Model;
ViewBag.owner = Model;
var top = Model.Medicines.Where(t => t.Dosage > 0).ToList();
var i = 1;
var i = 1;
}
}
...
@@ -64,29 +63,29 @@
...
@@ -64,29 +63,29 @@
<!-- Portfolio Grid Items -->
<!-- Portfolio Grid Items -->
<div class="row d-flex flex-wrap justify-content-sm-center">
<div class="row d-flex flex-wrap justify-content-sm-center">
@if (Model.Medic
in
es.Count() == 0)
@if (Model.Medic
alStat
es.Count() == 0)
{
{
<h2 class="text-center">You dont have any Medic
in
e</h2>
<h2 class="text-center">You dont have any Medic
alStat
e</h2>
<img src="~/img/portfolio/noData.jpg" class="figure-img" />
<img src="~/img/portfolio/noData.jpg" class="figure-img" />
}
}
else
else
@foreach (var item in Model.Medic
in
es)
@foreach (var item in Model.Medic
alStat
es)
{
{
<div class="col-lg-4">
<div class="col-lg-4">
<div class="card m-3">
<div class="card m-3">
<img src="/img/portfolio/
@item.Image
"
<img src="/img/portfolio/
flappy.png
"
class="card-img-top img-fluid" style="max-height:250px "
class="card-img-top img-fluid" style="max-height:250px "
alt="Waterfall" />
alt="Waterfall" />
<div class="card-body">
<div class="card-body">
<h5 class="card-title">@item.Name</h5>
<h5 class="card-title">@item.
State
Name</h5>
<p class="card-text">
<p class="card-text">
@item.Description
@item.
State
Description
<br />
<br />
Price : @item.Pric
e <br />
Date : @item.PrescriptionTim
e <br />
Type : @item.MedicineType
Medicines : @item.Medicines.Count()
</p>
</p>
<a href="#" class="btn btn-primary" data-toggle="modal" data-target="#item-@(item.Id)">go to descriptiuon </a>
<a href="#" class="btn btn-primary" data-toggle="modal" data-target="#item-@(item.Id)">go to descriptiuon </a>
...
@@ -171,7 +170,7 @@
...
@@ -171,7 +170,7 @@
</section>
</section>
<!-- Modals -->
<!-- Modals -->
@foreach (var item in Model.Medic
in
es)
@foreach (var item in Model.Medic
alStat
es)
{
{
<!-- Portfolio Modal -->
<!-- Portfolio Modal -->
<div class="portfolio-modal modal fade" id="item-@(item.Id)" tabindex="-1" role="dialog" aria-labelledby="label-@item.Id" aria-hidden="true">
<div class="portfolio-modal modal fade" id="item-@(item.Id)" tabindex="-1" role="dialog" aria-labelledby="label-@item.Id" aria-hidden="true">
...
@@ -188,7 +187,7 @@
...
@@ -188,7 +187,7 @@
<div class="row justify-content-center">
<div class="row justify-content-center">
<div class="col-lg-8">
<div class="col-lg-8">
<!-- Portfolio Modal - Title -->
<!-- Portfolio Modal - Title -->
<h2 class="portfolio-modal-title text-secondary text-uppercase mb-0">@item.Name </h2>
<h2 class="portfolio-modal-title text-secondary text-uppercase mb-0">@item.
State
Name </h2>
<!-- Icon Divider -->
<!-- Icon Divider -->
<div class="divider-custom">
<div class="divider-custom">
<div class="divider-custom-line"></div>
<div class="divider-custom-line"></div>
...
@@ -198,13 +197,13 @@
...
@@ -198,13 +197,13 @@
<div class="divider-custom-line"></div>
<div class="divider-custom-line"></div>
</div>
</div>
<!-- Portfolio Modal - Image -->
<!-- Portfolio Modal - Image -->
<img class="img-fluid rounded mb-5" src=
@("/img/portfolio/"+item.Image ) )
alt="">
<img class="img-fluid rounded mb-5" src=
"/img/portfolio/ecole.png"
alt="">
<!-- Portfolio Modal - Text -->
<!-- Portfolio Modal - Text -->
<p class="mb-5">
medicine Description : @item.
Description</p>
<p class="mb-5">
State Description : @item.State
Description</p>
<p class="mb-5">
medicine price : @item.Pric
e</p>
<p class="mb-5">
State Name : @item.StateNam
e</p>
<p class="mb-5">
medicine Dosage : @item.Dosag
e</p>
<p class="mb-5">
State Time : @item.PrescriptionTim
e</p>
<a asp-action="Medic
in
eDetails" role="button" class="btn btn-primary" asp-controller="Home" asp-route-id="@item.Id">View More </a>
<a asp-action="Medic
alStat
eDetails" role="button" class="btn btn-primary" asp-controller="Home" asp-route-id="@item.Id">View More </a>
<button class="btn btn-primary" href="#" data-dismiss="modal">
<button class="btn btn-primary" href="#" data-dismiss="modal">
<i class="fas fa-times fa-fw"></i>
<i class="fas fa-times fa-fw"></i>
Close Window
Close Window
...
...
WebPresentation/Views/Home/Medic
in
eDetails.cshtml
→
WebPresentation/Views/Home/Medic
alStat
eDetails.cshtml
View file @
5f496869
@model Medic
in
e
@model Medic
alStat
e
@{
@{
ViewData["Title"] = "Medic
in
e Details ";
ViewData["Title"] = "Medic
al Stat
e Details ";
var a = 0;
var a = 0;
...
@@ -15,9 +15,9 @@
...
@@ -15,9 +15,9 @@
<div class="row g-0">
<div class="row g-0">
<div class="col-md-4 gradient-custom text-center text-black"
<div class="col-md-4 gradient-custom text-center text-black"
style="border-top-left-radius: .5rem; border-bottom-left-radius: .5rem;">
style="border-top-left-radius: .5rem; border-bottom-left-radius: .5rem;">
<img src="~/img/portfolio/
@Model.Image
"
<img src="~/img/portfolio/
ecole.png
"
alt="Avatar" class="img-fluid my-5" style="width: 80px;" />
alt="Avatar" class="img-fluid my-5" style="width: 80px;" />
<h5>@Model.
Name
</h5>
<h5>@Model.</h5>
<p>For: @(Model.Category is null ? "":Model.Category.Name)</p>
<p>For: @(Model.Category is null ? "":Model.Category.Name)</p>
<a asp-action="Edit" asp-route-id="@Model.Id">
<a asp-action="Edit" asp-route-id="@Model.Id">
<i class="far fa-edit mb-5"></i>
<i class="far fa-edit mb-5"></i>
...
...
WebPresentation/Views/Medicine/Create.cshtml
View file @
5f496869
...
@@ -16,9 +16,16 @@
...
@@ -16,9 +16,16 @@
<form asp-action="Create">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<div class="form-group">
<label asp-for="Name" class="control-label"></label>
<div class="col-5">
<input asp-for="Name" class="form-control" />
<label asp-for="TradeName" class="control-label"></label>
<span asp-validation-for="Name" class="text-danger"></span>
<input asp-for="TradeName" class="form-control" />
<span asp-validation-for="TradeName" class="text-danger"></span>
</div>
<div class="col-5">
<label asp-for="ScintificName" class="control-label"></label>
<input asp-for="ScintificName" class="form-control" />
<span asp-validation-for="ScintificName" class="text-danger"></span>
</div>
</div>
</div>
<div class="form-group">
<div class="form-group">
<label asp-for="Description" class="control-label"></label>
<label asp-for="Description" class="control-label"></label>
...
...
WebPresentation/obj/Debug/net5.0/WebPresentation.csproj.AssemblyReference.cache
View file @
5f496869
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment