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
{
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
int
Price
{
get
;
set
;
}
public
String
Image
{
get
;
set
;
}
public
int
Dosage
{
get
;
set
;
}
public
Category
Category
{
get
;
set
;
}
public
MedicineType
MedicineType
{
get
;
set
;
}
#
region
Relations
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
<
Patient
>
Patients
{
get
;
set
;
}
public
ICollection
<
PatientMedicine
>
PatientMedicines
{
get
;
set
;
}
// public ICollection<PatientMedicine> PatientMedicines { get; set; }
public
void
AddIngredient
(
Ingredient
ingredient
,
int
ratio
)
{
MedicineIngredients
.
Add
(
...
...
@@ -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
public
String
UserId
{
get
;
set
;
}
public
User
User
{
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
public
interface
IPatientService
{
public
IEnumerable
<
Medic
ine
>
GetPatientMedicin
es
(
int
patientId
);
public
Medic
ine
GetMedicineDetails
(
int
id
,
params
Expression
<
Func
<
Medicin
e
,
object
>>[]
includeProperties
);
public
IEnumerable
<
Medic
alState
>
GetPatientMedicalStat
es
(
int
patientId
);
public
Medic
alState
GetMedicalStateDetails
(
int
id
,
params
Expression
<
Func
<
MedicalStat
e
,
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
void
Insert
(
Patient
owner
);
public
void
Update
(
Patient
owner
);
public
void
Insert
(
Patient
patient
);
public
void
Update
(
Patient
patient
);
public
void
Delete
(
int
id
);
public
bool
PatientExists
(
int
id
);
...
...
ApplicationCore/Services/PatientService/PatientService.cs
View file @
5f496869
...
...
@@ -14,52 +14,50 @@ namespace ApplicationCore.Services.PatientService
public
class
PatientService
:
IPatientService
{
private
readonly
IUnitOfWork
<
Patient
>
_patientUnitOfWork
;
private
readonly
IUnitOfWork
<
Medic
ine
>
_medicin
eUnitOfWork
;
private
readonly
IUnitOfWork
<
Medic
alState
>
_medicalStat
eUnitOfWork
;
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
;
_medic
ineUnitOfWork
=
medicin
eUnitOfWork
;
_medic
alStateUnitOfWork
=
medicalStat
eUnitOfWork
;
_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
.
GetById
(
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
)
{
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
);
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
;
}
ptient
.
PatientMedicines
.
Add
(
new
PatientMedicine
{
Medicine
=
medicine
,
Patient
=
ptient
,
PrescripDate
=
DateTime
.
Now
});
ptient
.
MedicalStates
.
Add
(
medicalState
);
_patientUnitOfWork
.
Entity
.
Update
(
ptient
);
_patientUnitOfWork
.
Save
();
}
...
...
@@ -68,19 +66,19 @@ namespace ApplicationCore.Services.PatientService
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
();
}
public
void
Update
(
Patient
owner
)
public
void
Update
(
Patient
patient
)
{
_patientUnitOfWork
.
Entity
.
Update
(
owner
);
_patientUnitOfWork
.
Entity
.
Update
(
patient
);
_patientUnitOfWork
.
Save
();
}
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
AddInclude
(
p
=>
p
.
MedicineIngredients
);
AddInclude
(
p
=>
p
.
Category
);
AddInclude
(
p
=>
p
.
MedicineType
);
AddInclude
(
p
=>
p
.
Patient
s
);
AddInclude
(
p
=>
p
.
MedicalState
s
);
AddInclude
(
p
=>
p
.
Ingredients
);
AddThenInclude
(
"MedicineIngredients.Ingredient"
);
...
...
ApplicationCore/Specification/PatientMedicinesSpecification.cs
View file @
5f496869
...
...
@@ -12,9 +12,10 @@ namespace ApplicationCore.Specification
{
public
PatientMedicinesSpecification
()
{
AddInclude
(
p
=>
p
.
Medic
in
es
);
AddInclude
(
p
=>
p
.
Medic
alStat
es
);
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
public
DbSet
<
Ingredient
>
Ingredients
{
get
;
set
;
}
public
DbSet
<
Category
>
Categories
{
get
;
set
;
}
public
DbSet
<
MedicineType
>
MedicineTypes
{
get
;
set
;
}
public
DbSet
<
MedicalState
>
MedicalStates
{
get
;
set
;
}
protected
override
void
OnConfiguring
(
DbContextOptionsBuilder
optionsBuilder
)
{
...
...
@@ -49,17 +50,22 @@ namespace Infrastructure.Data
);
modelBuilder
.
Entity
<
Patient
>()
.
HasMany
(
e
=>
e
.
MedicalStates
)
.
WithOne
(
e
=>
e
.
Patient
);
modelBuilder
.
Entity
<
MedicalState
>()
.
HasMany
(
e
=>
e
.
Medicines
)
.
WithMany
(
e
=>
e
.
Patient
s
)
.
UsingEntity
<
Patient
Medicine
>(
.
WithMany
(
e
=>
e
.
MedicalState
s
)
.
UsingEntity
<
MedicalState
Medicine
>(
l
=>
l
.
HasOne
<
Medicine
>(
e
=>
e
.
Medicine
)
.
WithMany
(
e
=>
e
.
Patient
Medicines
)
.
WithMany
(
e
=>
e
.
MedicalState
Medicines
)
.
HasForeignKey
(
e
=>
e
.
MedicineId
),
r
=>
r
.
HasOne
<
Patient
>(
e
=>
e
.
Patient
)
.
WithMany
(
e
=>
e
.
Patient
Medicines
)
.
HasForeignKey
(
e
=>
e
.
Patient
Id
)
r
=>
r
.
HasOne
<
MedicalState
>(
e
=>
e
.
MedicalState
)
.
WithMany
(
e
=>
e
.
MedicalState
Medicines
)
.
HasForeignKey
(
e
=>
e
.
MedicalState
Id
)
);
modelBuilder
.
Entity
<
Patient
>()
.
HasOne
(
o
=>
o
.
User
);
...
...
@@ -109,7 +115,7 @@ namespace Infrastructure.Data
);
#
endregion
Roles
#
region
User
PasswordHasher
<
User
>
ph
=
new
PasswordHasher
<
User
>();
var
ph
=
new
PasswordHasher
<
Identity
User
>();
var
admin
=
new
User
{
...
...
@@ -119,7 +125,8 @@ namespace Infrastructure.Data
Avatar
=
"avatar.jpg"
,
Email
=
"hasan@b"
,
UserName
=
"Hasan.Bahjat"
,
NormalizedEmail
=
"hasan@b"
,
PasswordHash
=
ph
.
HashPassword
(
null
,
"123@Aa"
),
NormalizedEmail
=
"hasan@b"
,
NormalizedUserName
=
"Hasan.Bahjat"
,
CreationTime
=
DateTime
.
Now
...
...
@@ -131,16 +138,14 @@ namespace Infrastructure.Data
LastName
=
"Khaddour"
,
Avatar
=
"avatar1.jpg"
,
Email
=
"hasan.bahjat@mail.y"
,
PasswordHash
=
ph
.
HashPassword
(
null
,
"123@Aa"
),
UserName
=
"Hasan.Khaddour"
,
NormalizedEmail
=
"hasan@b"
,
NormalizedUserName
=
"Hasan.khaddour"
,
CreationTime
=
DateTime
.
Now
};
admin
.
PasswordHash
=
ph
.
HashPassword
(
admin
,
"123@Aa"
);
PatientAccount
.
PasswordHash
=
ph
.
HashPassword
(
PatientAccount
,
"123@Aa"
);
modelBuilder
.
Entity
<
User
>()
.
HasData
(
admin
,
...
...
@@ -161,24 +166,52 @@ namespace Infrastructure.Data
);
#
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
var
med
=
new
Medicine
{
Id
=-
1
,
Name
=
"Augmentine"
,
Id
=
1
,
ScintificName
=
"Augmentine"
,
TradeName
=
"Augmentine"
,
ManufactureName
=
"Ibin Sina"
,
SideEffect
=
"No. "
,
Category
=
c1
,
Image
=
"med1.png"
,
Dosage
=
12
,
Price
=
2500
,
};
var
c
=
new
Category
{
Id
=
1
,
Name
=
"Augmentine"
};
modelBuilder
.
Entity
<
Category
>().
HasData
(
c
);
// med.Category = c;
modelBuilder
.
Entity
<
Medicine
>().
HasData
(
med
);
#
endregion
Medicines
#
region
MedicalState
#
endregion
MedicalState
}
}
}
WebPresentation/Controllers/HomeController.cs
View file @
5f496869
...
...
@@ -21,14 +21,19 @@ namespace WebPresentation.Controllers
{
private
readonly
PatientService
_patientService
;
private
readonly
MedicineService
_medicineService
;
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
;
_patientService
=
new
PatientService
(
patientUnitOfWork
,
medicineUnitOfWork
);
_medicineService
=
new
MedicineService
(
medicineUnitOfWork
);
_patientService
=
new
PatientService
(
patientUnitOfWork
,
medicalStateUnitOfWork
);
}
...
...
@@ -39,9 +44,7 @@ namespace WebPresentation.Controllers
var
ownesr
=
_patientService
.
GetAll
(
u
=>
u
.
User
,
u
=>
u
.
Medicines
)
)
.
Where
(
u
=>
u
.
User
.
Id
==
userId
)
...
...
@@ -50,13 +53,9 @@ namespace WebPresentation.Controllers
return
View
(
ownesr
);
}
public
IActionResult
MedicineDetails
(
int
id
)
{
var
s
=
_patientService
.
GetMedicineDetails
(
id
,
i
=>
i
.
MedicineIngredients
,
i
=>
i
.
Ingredients
,
i
=>
i
.
Category
,
i
=>
i
.
MedicineType
);
public
IActionResult
MedicalStateDetails
(
int
id
)
{
var
s
=
_patientService
.
GetMedicalStateDetails
(
id
);
if
(
s
is
null
)
{
return
NotFound
();
}
...
...
@@ -68,13 +67,13 @@ namespace WebPresentation.Controllers
return
View
();
}
public
IActionResult
AddMedic
in
e
(
int
id
)
{
public
IActionResult
AddMedic
alStat
e
(
int
id
)
{
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
();
var
m
=
_
medicineService
.
GetMedicin
eDetails
(
id
);
_patientService
.
AddMedic
in
e
(
patient
.
Id
,
m
);
var
m
=
_
patientService
.
GetMedicalStat
eDetails
(
id
);
_patientService
.
AddMedic
alStat
e
(
patient
.
Id
,
m
);
return
RedirectToAction
(
"Index"
,
"Home"
);
...
...
WebPresentation/Controllers/MedicineController.cs
View file @
5f496869
...
...
@@ -26,11 +26,12 @@ namespace WebPresentation.Controllers
public
MedicineController
(
UserManager
<
User
>
userManager
,
IUnitOfWork
<
Patient
>
patientUnitOfWork
,
IUnitOfWork
<
Medicine
>
medicineUnitOfWork
,
IUnitOfWork
<
MedicalState
>
medicalStateUnitOfWork
,
IUnitOfWork
<
Ingredient
>
ingredientUnitOfWork
):
base
(
userManager
)
{
_ingredientService
=
new
IngredientService
(
ingredientUnitOfWork
);
_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 @@
ViewData["userName"] = Model.User.FirstName + " " + Model.User.LastName;
ViewBag.owner = Model;
var top = Model.Medicines.Where(t => t.Dosage > 0).ToList();
var i = 1;
}
...
...
@@ -64,29 +63,29 @@
<!-- Portfolio Grid Items -->
<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" />
}
else
@foreach (var item in Model.Medic
in
es)
@foreach (var item in Model.Medic
alStat
es)
{
<div class="col-lg-4">
<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 "
alt="Waterfall" />
<div class="card-body">
<h5 class="card-title">@item.Name</h5>
<h5 class="card-title">@item.
State
Name</h5>
<p class="card-text">
@item.Description
@item.
State
Description
<br />
Price : @item.Pric
e <br />
Date : @item.PrescriptionTim
e <br />
Type : @item.MedicineType
Medicines : @item.Medicines.Count()
</p>
<a href="#" class="btn btn-primary" data-toggle="modal" data-target="#item-@(item.Id)">go to descriptiuon </a>
...
...
@@ -171,7 +170,7 @@
</section>
<!-- Modals -->
@foreach (var item in Model.Medic
in
es)
@foreach (var item in Model.Medic
alStat
es)
{
<!-- Portfolio Modal -->
<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 @@
<div class="row justify-content-center">
<div class="col-lg-8">
<!-- 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 -->
<div class="divider-custom">
<div class="divider-custom-line"></div>
...
...
@@ -198,13 +197,13 @@
<div class="divider-custom-line"></div>
</div>
<!-- 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 -->
<p class="mb-5">
medicine Description : @item.
Description</p>
<p class="mb-5">
medicine price : @item.Pric
e</p>
<p class="mb-5">
medicine Dosage : @item.Dosag
e</p>
<p class="mb-5">
State Description : @item.State
Description</p>
<p class="mb-5">
State Name : @item.StateNam
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">
<i class="fas fa-times fa-fw"></i>
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;
...
...
@@ -15,9 +15,9 @@
<div class="row g-0">
<div class="col-md-4 gradient-custom text-center text-black"
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;" />
<h5>@Model.
Name
</h5>
<h5>@Model.</h5>
<p>For: @(Model.Category is null ? "":Model.Category.Name)</p>
<a asp-action="Edit" asp-route-id="@Model.Id">
<i class="far fa-edit mb-5"></i>
...
...
WebPresentation/Views/Medicine/Create.cshtml
View file @
5f496869
...
...
@@ -16,9 +16,16 @@
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="Name" class="control-label"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
<div class="col-5">
<label asp-for="TradeName" class="control-label"></label>
<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 class="form-group">
<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