-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomeController.cs
56 lines (51 loc) · 1.97 KB
/
HomeController.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Mvc;
using SayHenTai_WebApp.Infrastructure.Caching;
using SayHenTai_WebApp.Infrastructure.Entities;
using SayHenTai_WebApp.Infrastructure.Service;
using SayHenTai_WebApp.Models;
using System.Diagnostics;
namespace SayHenTai_WebApp.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly TruyenService _truyenService;
private readonly MemoryCacheService _memoryCacheService;
private readonly IDataProtector _dataProtector;
public HomeController(ILogger<HomeController> logger,
MemoryCacheService memoryCacheService,
TruyenService truyenService,
IDataProtectionProvider dataProtectionProvider)
{
_logger = logger;
_memoryCacheService = memoryCacheService;
_dataProtector = dataProtectionProvider.CreateProtector("account");
_truyenService = truyenService;
}
public async Task<IActionResult> Index()
{
var model = await _truyenService.GetAllDanhSachTruyen();
return View(model);
}
public async Task<IActionResult> ChuongMucDetails(long id)
{
var model = await _truyenService.getChuongMucTruyenByIdTruyen(id);
return View(model);
}
public async Task<IActionResult> Details(long IdChuongMuc, long IdTruyen)
{
var model = await _truyenService.getDetailTruyenByIdTruyenAndIdChuongMuc(IdChuongMuc, IdTruyen);
return View(model);
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}