namespace Neighbourhood.omg.lol.Models { public class Paste { public string? Url; public string Title { get; set; } = string.Empty; public string Content { get; set; } = string.Empty; public long? ModifiedOn { get; set; } public int Listed { get; set; } public bool IsListed { get => Listed != 0; set => Listed = value ? 1 : 0; } public DateTimeOffset ModifiedTime { get => DateTimeOffset.UnixEpoch.AddSeconds(ModifiedOn ?? 0); } public string RelativeTime { get { TimeSpan offset = DateTimeOffset.UtcNow - ModifiedTime; var offsetString = string.Empty; if (offset.TotalDays >= 1) offsetString = $"{Math.Floor(offset.TotalDays)} days ago"; else if (offset.TotalHours >= 1) offsetString = $"{Math.Floor(offset.TotalHours)} hours, {offset.Minutes} minutes ago"; else if (offset.TotalMinutes >= 1) offsetString = $"{Math.Floor(offset.TotalMinutes)} minutes ago"; else offsetString = $"{Math.Floor(offset.TotalSeconds)} seconds ago"; return offsetString; } } } }