Exemplo n.º 1
0
            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);
            }
Exemplo n.º 2
0
            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);
            }