Skip to content

Instantly share code, notes, and snippets.

@cwe1ss
Created August 9, 2014 13:18
Embed
What would you like to do?
public interface IAppCookies
{
string UserEmail { get; set; }
DateTime? LastVisit { get; set; }
}
public class AppCookies : IAppCookies
{
private readonly ICookieContainer _cookieContainer;
public AppCookies(ICookieContainer cookieContainer)
{
_cookieContainer = cookieContainer;
}
public string UserEmail
{
get { return _cookieContainer.GetValue("UserEmail"); }
set { _cookieContainer.SetValue("UserEmail", value, DateTime.Now.AddDays(10)); }
}
public DateTime? LastVisit
{
get { return _cookieContainer.GetValue<DateTime?>("LastVisit"); }
set { _cookieContainer.SetValue("LastVisit", value, DateTime.Now.AddDays(10)); }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment