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
e56ba2ab
Commit
e56ba2ab
authored
May 21, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add patient service
parent
1889693b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
PatientService.cs
ApplicationCore/Services/Patient/PatientService.cs
+75
-0
No files found.
ApplicationCore/Services/Patient/PatientService.cs
0 → 100644
View file @
e56ba2ab
using
ApplicationCore.Entities
;
using
ApplicationCore.Interfaces
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
ApplicationCore.Services.PatientService
{
public
class
PatientService
{
private
readonly
IUnitOfWork
<
Patient
>
_patientUnitOfWork
;
private
readonly
IUnitOfWork
<
Medicine
>
_medicineUnitOfWork
;
public
PatientService
(
IUnitOfWork
<
Patient
>
patientUnitOfWork
,
IUnitOfWork
<
Medicine
>
medicineUnitOfWork
)
{
_patientUnitOfWork
=
patientUnitOfWork
;
_medicineUnitOfWork
=
medicineUnitOfWork
;
}
public
IEnumerable
<
Medicine
>
GetPatientMedicines
(
int
patientId
)
{
return
_patientUnitOfWork
.
Entity
.
GetById
(
patientId
,
p
=>
p
.
Medicines
).
Medicines
.
AsEnumerable
();
}
public
Medicine
GetMedicineDetails
(
int
id
)
{
return
_medicineUnitOfWork
.
Entity
.
GetById
(
id
,
i
=>
i
.
MedicineIngredients
,
i
=>
i
.
Ingredients
);
}
public
IEnumerable
<
Patient
>
getAll
(
params
Expression
<
Func
<
Patient
,
object
>>[]
includeProperties
)
{
return
_patientUnitOfWork
.
Entity
.
GetAll
(
includeProperties
);
}
public
void
AddMedicine
(
int
patientId
,
Medicine
medicine
)
{
var
ptient
=
_patientUnitOfWork
.
Entity
.
GetById
(
patientId
,
p
=>
p
.
Medicines
);
ptient
.
Medicines
.
Add
(
medicine
);
}
public
Patient
getById
(
int
id
,
params
Expression
<
Func
<
Patient
,
object
>>[]
includeProperties
)
{
return
_patientUnitOfWork
.
Entity
.
GetById
(
id
,
includeProperties
);
}
public
void
insert
(
Patient
owner
)
{
_patientUnitOfWork
.
Entity
.
Insert
(
owner
);
_patientUnitOfWork
.
Save
();
}
public
void
update
(
Patient
owner
)
{
_patientUnitOfWork
.
Entity
.
Update
(
owner
);
_patientUnitOfWork
.
Save
();
}
public
void
delete
(
int
id
)
{
_patientUnitOfWork
.
Entity
.
Delete
(
id
);
_patientUnitOfWork
.
Save
();
}
public
bool
ownerExists
(
int
id
)
{
return
_patientUnitOfWork
.
Entity
.
GetById
(
id
)
is
null
?
false
:
true
;
}
}
}
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