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
52f7ca00
Commit
52f7ca00
authored
May 21, 2024
by
hasan khaddour
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update home controller
parent
3de96791
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
HomeController.cs
WebPresentation/Controllers/HomeController.cs
+23
-5
No files found.
WebPresentation/Controllers/HomeController.cs
View file @
52f7ca00
using
Microsoft.AspNetCore.Mvc
;
using
ApplicationCore.Entities
;
using
ApplicationCore.Interfaces
;
using
ApplicationCore.Services.PatientService
;
using
Microsoft.AspNetCore.Authorization
;
using
Microsoft.AspNetCore.Identity
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Logging
;
using
System
;
using
System.Collections.Generic
;
...
...
@@ -11,23 +16,36 @@ namespace WebPresentation.Controllers
{
public
class
HomeController
:
Controller
{
private
readonly
ILogger
<
HomeController
>
_logger
;
private
readonly
PatientService
_patientService
;
private
readonly
UserManager
<
User
>
_userManager
;
public
HomeController
(
ILogger
<
HomeController
>
logger
)
public
HomeController
(
UserManager
<
User
>
userManager
,
IUnitOfWork
<
Patient
>
patientUnitOfWork
,
IUnitOfWork
<
Medicine
>
medicineUnitOfWork
)
{
_logger
=
logger
;
_userManager
=
userManager
;
_patientService
=
new
PatientService
(
patientUnitOfWork
,
medicineUnitOfWork
);
}
[
Authorize
]
public
IActionResult
Index
()
{
return
View
();
var
userId
=
_userManager
.
GetUserId
(
User
);
// var s = User.Claims.Where(u => u.Type == "UserName");
var
ownesr
=
_patientService
.
getAll
(
u
=>
u
.
User
,
u
=>
u
.
Medicines
).
Where
(
u
=>
u
.
User
.
Id
==
userId
).
FirstOrDefault
();
return
View
(
ownesr
);
}
public
IActionResult
MedicineDetails
(
int
id
)
{
var
s
=
_patientService
.
GetMedicineDetails
(
id
);
return
View
(
s
);
}
public
IActionResult
Privacy
()
{
return
View
();
}
[
ResponseCache
(
Duration
=
0
,
Location
=
ResponseCacheLocation
.
None
,
NoStore
=
true
)]
public
IActionResult
Error
()
{
...
...
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