-
Notifications
You must be signed in to change notification settings - Fork 1
/
HomeController.cs
42 lines (37 loc) · 1.35 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
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using StartupProject_Asp.NetCore_PostGRE.Attributes;
using StartupProject_Asp.NetCore_PostGRE.Data.Enums;
using StartupProject_Asp.NetCore_PostGRE.Models;
using StartupProject_Asp.NetCore_PostGRE.Services.EmailService;
namespace StartupProject_Asp.NetCore_PostGRE.Controllers
{
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly IEmailSender Mailer;
public HomeController(ILogger<HomeController> logger, IEmailSender mailer)
{
_logger = logger;
Mailer = mailer;
}
public IActionResult Index()
{
//Mailer.SendEmailAsync("[email protected]","Subject","Body");
return View();
}
//[Authorize(Roles = "SuperAdmin")]
//[Authorize(Policy ="CanRead")] -> Should implement
[AuthorizeRoles(ERole.SuperAdmin, ERole.Admin)]
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 });
}
}
}