Controller cleanup (#30)
* Cleaning up routes. * Adding signout functionality * Added simple checkout behavior
This commit is contained in:
@@ -8,6 +8,7 @@ using Infrastructure.Identity;
|
||||
|
||||
namespace Microsoft.eShopWeb.Controllers
|
||||
{
|
||||
[Route("[controller]/[action]")]
|
||||
public class AccountController : Controller
|
||||
{
|
||||
private readonly UserManager<ApplicationUser> _userManager;
|
||||
@@ -17,7 +18,7 @@ namespace Microsoft.eShopWeb.Controllers
|
||||
public AccountController(
|
||||
UserManager<ApplicationUser> userManager,
|
||||
SignInManager<ApplicationUser> signInManager,
|
||||
IOptions<IdentityCookieOptions> identityCookieOptions
|
||||
IOptions<IdentityCookieOptions> identityCookieOptions
|
||||
|
||||
)
|
||||
{
|
||||
@@ -58,6 +59,16 @@ namespace Microsoft.eShopWeb.Controllers
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<ActionResult> SignOut()
|
||||
{
|
||||
HttpContext.Session.Clear();
|
||||
await _signInManager.SignOutAsync();
|
||||
|
||||
return RedirectToAction(nameof(CatalogController.Index), "Catalog");
|
||||
}
|
||||
|
||||
private IActionResult RedirectToLocal(string returnUrl)
|
||||
{
|
||||
if (Url.IsLocalUrl(returnUrl))
|
||||
|
||||
Reference in New Issue
Block a user