private static ConfessLoader GetConfessLoader(Confess dt, string key) { ConfessLoader loader = new ConfessLoader { Body = dt.Body, Category = dt.Category, Date = Shared.TimeAgo.Ago(dt.Date),//$"{dt.Date.ToLongDateString()} {dt.Date.ToShortTimeString()}", DateReal = dt.Date, DisLikes = DislikeClass.GetCount(dt.Guid, false), Likes = LikeClass.GetCount(dt.Guid, false), Guid = dt.Guid, Owner_Guid = dt.Owner_Guid, Title = dt.Title, CommentCount = CommentClass.GetCommentCount(dt.Guid), Seen = SeenClass.GetCount(dt.Guid) }; //load colors if (LikeClass.CheckExistence(dt.Guid, false, key)) { loader.LikeColorString = "#1976D2"; } if (DislikeClass.CheckExistence(dt.Guid, false, key)) { loader.DislikeColorString = "#1976D2"; } return(loader); }
private static CommentLoader GetLoader(Comment dt, string key) { CommentLoader loader = new CommentLoader { Body = dt.Body, Date = Shared.TimeAgo.Ago(dt.Date),// $"{CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedDayName(dt.Date.DayOfWeek)}, {CultureInfo.CurrentCulture.DateTimeFormat.GetAbbreviatedMonthName(dt.Date.Month)} {dt.Date.Day}, {dt.Date.Year} {dt.Date.ToShortTimeString()}", DisLikes = DislikeClass.GetCount(dt.Guid, true), DateReal = dt.Date, Likes = LikeClass.GetCount(dt.Guid, true), Guid = dt.Guid, Owner_Guid = dt.Owner_Guid, Quote = dt.Quote, QuotedCommentAvailable = dt.QuotedCommentAvailable, Confess_Guid = dt.Confess_Guid }; //load colors if (LikeClass.CheckExistence(dt.Guid, true, key)) { loader.LikeColorString = "#1976D2"; } if (DislikeClass.CheckExistence(dt.Guid, true, key)) { loader.DislikeColorString = "#1976D2"; } if (dt.Owner_Guid == key) { loader.DeleteVisibility = true; } return(loader); }
private static List <ConfessLoader> GetConfessLoader(List <Confess> list, string key) { List <ConfessLoader> loaders = new List <ConfessLoader>(); foreach (Confess dt in list) { ConfessLoader loader = new ConfessLoader { Body = dt.Body, Category = dt.Category, Date = Shared.TimeAgo.Ago(dt.Date),// $"{dt.Date.ToLongDateString()} {dt.Date.ToShortTimeString()}", DateReal = dt.Date, DisLikes = DislikeClass.GetCount(dt.Guid, false), Likes = LikeClass.GetCount(dt.Guid, false), Guid = dt.Guid, Owner_Guid = dt.Owner_Guid, Title = dt.Title, CommentCount = CommentClass.GetCommentCount(dt.Guid), Seen = SeenClass.GetCount(dt.Guid) }; //load colors if (LikeClass.CheckExistence(dt.Guid, false, key)) { loader.LikeColorString = "#1976D2"; } if (DislikeClass.CheckExistence(dt.Guid, false, key)) { loader.DislikeColorString = "#1976D2"; } loaders.Add(loader); loader = new ConfessLoader(); } loaders = loaders.OrderByDescending(d => d.DateReal).Reverse().ToList(); return(loaders); }