Ejemplo n.º 1
0
        // GET: Comment
        public ActionResult Index(int postId)
        {
            List <Comment> Comments = cRepo.Get(pRepo.Get(postId));


            var top    = uRepo.GetTop();
            var extras = new Dictionary <string, int>();

            extras.Add(top[0].Username, 0);
            extras.Add(top[1].Username, 1);
            extras.Add(top[2].Username, 2);
            extras.Add(top[3].Username, 3);
            extras.Add(top[4].Username, 4);

            List <CVMExtra> CVM = new List <CVMExtra>();

            foreach (var i in Comments)
            {
                if (extras.ContainsKey(i.User.Username))
                {
                    CVM.Add(new CVMExtra()
                    {
                        Comment = i, CommentRating = extras[i.User.Username]
                    });
                }
                else
                {
                    CVM.Add(new CVMExtra()
                    {
                        Comment = i, CommentRating = 10
                    });
                }
            }
            return(PartialView("CommentIndexPartial", CVM));
        }