32 lines
712 B
C#
32 lines
712 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace TIAMWebApp.Shared.Application.Utility
|
|
{
|
|
public class PageHistoryState
|
|
{
|
|
private readonly List<string> _previousPages = [];
|
|
|
|
public PageHistoryState()
|
|
{ }
|
|
|
|
public void AddPageToHistory(string pageUrl)
|
|
{
|
|
_previousPages.Add(pageUrl);
|
|
}
|
|
|
|
public string GetGoBackPage()
|
|
{
|
|
return _previousPages.Count > 1 ? _previousPages[^2] : _previousPages.FirstOrDefault() ?? string.Empty;
|
|
}
|
|
|
|
public bool CanGoBack()
|
|
{
|
|
return _previousPages.Count > 1;
|
|
}
|
|
}
|
|
}
|