Beispiel #1
0
        public ActionResult TopicPosts(int ID, int?page, int?anchoredPostID)
        {
            Topic topic = forumComplexManager.GetTopic(ID);

            User user = (Session["Student"] as Student).User;

            ViewData["User"] = user;

            int _page = page == null ? 0 : page.Value - 1;

            TempData["Page"] = _page;
            List <ProfilePhotoFormData> ppfdList = new List <ProfilePhotoFormData>();

            if (anchoredPostID != null)
            {
                TempData["anchoredPostID"] = (int)anchoredPostID;

                Post anchoredPost = topic.Posts.SingleOrDefault(w => w.ID == anchoredPostID);

                _page            = topic.Posts.IndexOf(anchoredPost) % 15 == 0 ? topic.Posts.IndexOf(anchoredPost) / 15 : (topic.Posts.IndexOf(anchoredPost) / 15);
                TempData["Page"] = _page;
            }
            if (topic.Posts != null)
            {
                foreach (var item in topic.Posts)
                {
                    if (ppfdList.SingleOrDefault(w => w.ID == item.SentFeed.User.ID) == null)
                    {
                        ProfilePhotoFormData ppfd = new ProfilePhotoFormData();
                        ppfd.ID          = item.SentFeed.User.ID;
                        ppfd.Base64Image = item.SentFeed.User.ProfilePhoto;
                        ppfdList.Add(ppfd);
                    }
                }
            }
            TopicPageFormData tpfd = new TopicPageFormData();

            tpfd.Topic = topic;
            tpfd.ProfilePhotoFormDatas = ppfdList;
            return(View(tpfd));
        }
Beispiel #2
0
 public IHttpActionResult GetTopic(int ID)
 {
     return(Ok(forumComplexManager.GetTopic(ID)));
 }