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
97bb368d
Commit
97bb368d
authored
May 27, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modi. services
parent
3160c673
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
1 deletion
+75
-1
IngredientService.cs
...ationCore/Services/IngredientService/IngredientService.cs
+56
-0
MedicineService.cs
ApplicationCore/Services/MedicineService/MedicineService.cs
+15
-0
PatientService.cs
ApplicationCore/Services/Patient/PatientService.cs
+4
-1
No files found.
ApplicationCore/Services/IngredientService/IngredientService.cs
0 → 100644
View file @
97bb368d
using
ApplicationCore.Entities
;
using
ApplicationCore.Interfaces
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
ApplicationCore.Services.IngredientService
{
public
class
IngredientService
{
private
readonly
IUnitOfWork
<
Ingredient
>
_ingredientUnitOfWork
;
public
IngredientService
(
IUnitOfWork
<
Ingredient
>
ingredientUnitOfWork
)
{
_ingredientUnitOfWork
=
ingredientUnitOfWork
;
}
public
IEnumerable
<
Ingredient
>
GetAllIngredients
()
{
return
_ingredientUnitOfWork
.
Entity
.
GetAll
(
p
=>
p
.
MedicineIngredients
);
}
public
void
AddIngredient
(
Ingredient
ingredient
)
{
_ingredientUnitOfWork
.
Entity
.
Insert
(
ingredient
);
_ingredientUnitOfWork
.
Save
();
}
public
Ingredient
Update
(
Ingredient
ingredient
)
{
var
r
=
_ingredientUnitOfWork
.
Entity
.
Update
(
ingredient
);
_ingredientUnitOfWork
.
Save
();
return
r
;
}
public
Ingredient
GetIngredientDetails
(
int
id
)
{
return
_ingredientUnitOfWork
.
Entity
.
GetById
(
id
,
i
=>
i
.
MedicineIngredients
,
i
=>
i
.
Medicines
);
}
public
void
Delete
(
int
id
)
{
_ingredientUnitOfWork
.
Entity
.
Delete
(
id
);
_ingredientUnitOfWork
.
Save
();
}
}
}
ApplicationCore/Services/MedicineService/MedicineService.cs
View file @
97bb368d
...
@@ -24,6 +24,7 @@ namespace ApplicationCore.Services.MedicineService
...
@@ -24,6 +24,7 @@ namespace ApplicationCore.Services.MedicineService
);
);
}
}
public
void
AddMedicine
(
Medicine
medicine
)
{
public
void
AddMedicine
(
Medicine
medicine
)
{
_medicineUnitOfWork
.
Entity
.
Insert
(
medicine
);
_medicineUnitOfWork
.
Entity
.
Insert
(
medicine
);
_medicineUnitOfWork
.
Save
();
_medicineUnitOfWork
.
Save
();
...
@@ -49,6 +50,20 @@ namespace ApplicationCore.Services.MedicineService
...
@@ -49,6 +50,20 @@ namespace ApplicationCore.Services.MedicineService
return
_medicineUnitOfWork
.
Entity
.
GetById
(
id
,
i
=>
i
.
MedicineIngredients
,
i
=>
i
.
Ingredients
,
c
=>
c
.
Category
);
return
_medicineUnitOfWork
.
Entity
.
GetById
(
id
,
i
=>
i
.
MedicineIngredients
,
i
=>
i
.
Ingredients
,
c
=>
c
.
Category
);
}
}
public
Medicine
GetMedicineIngredentisDetails
(
int
medicineId
)
{
return
_medicineUnitOfWork
.
Entity
.
GetById
(
medicineId
,
i
=>
i
.
MedicineIngredients
,
i
=>
i
.
Ingredients
,
c
=>
c
.
Category
);
}
public
void
AddIngredient
(
int
medicineId
,
int
ratio
,
Ingredient
ingredient
)
{
var
m
=
GetMedicineIngredentisDetails
(
medicineId
);
m
.
AddIngredient
(
ingredient
,
ratio
);
_medicineUnitOfWork
.
Entity
.
Update
(
m
);
_medicineUnitOfWork
.
Save
();
}
public
void
Delete
(
int
id
)
{
public
void
Delete
(
int
id
)
{
_medicineUnitOfWork
.
Entity
.
Delete
(
id
);
_medicineUnitOfWork
.
Entity
.
Delete
(
id
);
_medicineUnitOfWork
.
Save
();
_medicineUnitOfWork
.
Save
();
...
...
ApplicationCore/Services/Patient/PatientService.cs
View file @
97bb368d
...
@@ -35,8 +35,11 @@ namespace ApplicationCore.Services.PatientService
...
@@ -35,8 +35,11 @@ namespace ApplicationCore.Services.PatientService
return
_patientUnitOfWork
.
Entity
.
GetAll
(
includeProperties
);
return
_patientUnitOfWork
.
Entity
.
GetAll
(
includeProperties
);
}
}
public
void
AddMedicine
(
int
patientId
,
Medicine
medicine
)
{
public
void
AddMedicine
(
int
patientId
,
Medicine
medicine
)
{
var
ptient
=
_patientUnitOfWork
.
Entity
.
GetById
(
patientId
,
p
=>
p
.
Medicines
);
var
ptient
=
_patientUnitOfWork
.
Entity
.
GetById
(
patientId
);
ptient
.
Medicines
.
Add
(
medicine
);
ptient
.
Medicines
.
Add
(
medicine
);
_patientUnitOfWork
.
Entity
.
Update
(
ptient
);
_patientUnitOfWork
.
Save
();
}
}
public
Patient
getById
(
int
id
,
params
Expression
<
Func
<
Patient
,
object
>>[]
includeProperties
)
public
Patient
getById
(
int
id
,
params
Expression
<
Func
<
Patient
,
object
>>[]
includeProperties
)
{
{
...
...
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