32 lines
845 B
C#
32 lines
845 B
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Model;
|
|
|
|
namespace Web.Areas.Admin.Controllers
|
|
{
|
|
|
|
|
|
[Authorize(Roles ="Admin")]
|
|
public class AdminController : Controller
|
|
{
|
|
private readonly SignInManager<ApplicationUser> _signInManager;
|
|
|
|
public AdminController(SignInManager<ApplicationUser> signInManager)
|
|
{
|
|
_signInManager = signInManager;
|
|
}
|
|
public IActionResult Index()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
[ValidateAntiForgeryToken]
|
|
public async Task<IActionResult> Logout()
|
|
{
|
|
await _signInManager.SignOutAsync();
|
|
return RedirectToAction("Login", "Account", new { area = "" }); // Redirect to frontend login page
|
|
}
|
|
}
|
|
}
|