Пример #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));
        }
Пример #2
0
        public ActionResult ConnectionDetails(int ID)
        {
            Connection conn = screenShareManager.GetConnection(ID);

            if ((Session["Student"] as Student).User.ID == conn.SharerID || (Session["Student"] as Student).User.ID == conn.ViewerID)
            {
                TempData["Unauthorized"] = true;
            }
            ConnectionDetailsFormData cdfd = new ConnectionDetailsFormData();

            cdfd.Connection = conn;

            foreach (var review in cdfd.Connection.Reviews)
            {
                ProfilePhotoFormData ppfd = new ProfilePhotoFormData();

                ppfd.ID          = review.Sender.ID;
                ppfd.Base64Image = "data:image/png;base64," + review.Sender.ProfilePhoto;

                cdfd.ProfilePhotoFormDatas.Add(ppfd);
            }
            return(View(cdfd));
        }