Commit 52f7ca00 authored by hasan khaddour's avatar hasan khaddour

update home controller

parent 3de96791
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()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment