@using NasimSys_V12.ControlPanel.Class.User; @using NasimSys_V12.Resources; @using Microsoft.Extensions.Localization; @using NasimSys_V12.ControlPanel.Class.Utility; @model UserC @inject IStringLocalizer<SharedResourceC> SharedLocalizer; @{ var objCurrentUserC = @Model; PublicC objPublicC = new PublicC(); } <form asp-controller="ActiveUserView" asp-action="Logout" method="post"> <button type="submit">Click here to Logout</button> </form>
using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using NasimSys_V12.ControlPanel.Class.User; namespace NasimSys_V12.ControlPanel.Components.User.ActiveUser { [ViewComponent(Name = "ActiveUserViewComponent")] public class ActiveUserViewController : Controller { public IActionResult Index() { return View(); } //================================================================== [HttpPost] public IActionResult Logout() { return View(); } //================================================================== //================================================================== public async Task<IActionResult> InvokeAsync( UserC objcurrentUserC_par, string ActiveUserViewName_par) { return await Task.Run(() => { return View(this.GetActiveUserViewName(ActiveUserViewName_par) , objcurrentUserC_par); }); } //================================================================== /// <summary> /// /// </summary> /// <param name="value_par">Set Empty or 'Default' if you wanna get default view </param> /// <returns></returns> public string GetActiveUserViewName(string value_par) { string result = string.Empty; if (value_par == "") { result = ""; } // else if value == 'Default' || anything else else { result = "~/ControlPanel/Components/User/ActiveUser/ActiveUserInHeader.cshtml"; } return result; } //================================================================== } }
<button type="submit">Click here to Logout</button>
asp-action="Logout"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)