예제 #1
0
        public ActionResult Detail(int photoItemID)
        {
            _pitm = new PhotoItem(photoItemID);

            if (_pitm.PhotoItemID == 0)
                return HttpNotFound();

            var sus = new StatusUpdates();

            var su = new StatusUpdate();

            su.GetStatusUpdateByPhotoID(photoItemID);

            su.PhotoDisplay = true;
            sus.Add(su);

            if (string.IsNullOrWhiteSpace(_pitm.Title))
            {
                _pitm.Title = String.Format("{0:u}", _pitm.CreateDate);
            }

            sus.IncludeStartAndEndTags = false;
            ViewBag.StatusUpdateList = string.Format(@"<ul id=""status_update_list_items"">{0}</ul>", sus.ToUnorderdList);

            var pitm2 = new PhotoItem();

            pitm2.GetPreviousPhoto(_pitm.CreateDate);
            if (pitm2.PhotoItemID > 0)
            {
                pitm2.ShowTitle = false;
                pitm2.UseThumb = true;
                ViewBag.PreviousPhoto = pitm2;
            }

            pitm2 = new PhotoItem();
            pitm2.GetNextPhoto(_pitm.CreateDate);

            if (pitm2.PhotoItemID > 0)
            {
                pitm2.ShowTitle = false;
                pitm2.UseThumb = true;
                ViewBag.NextPhoto = pitm2;
            }

            return View(_pitm);
        }
예제 #2
0
        public ActionResult UserPhoto(string userName, int photoItemID)
        {
            _ua = new UserAccount(userName);

            ViewBag.UserName = _ua.UserName;

            _pitm = new PhotoItem(photoItemID);

            var sus = new StatusUpdates();

            var su = new StatusUpdate();

            su.GetStatusUpdateByPhotoID(photoItemID);

            su.PhotoDisplay = true;
            sus.Add(su);

            if (string.IsNullOrWhiteSpace(_pitm.Title))
            {
                _pitm.Title = String.Format("{0:u}", _pitm.CreateDate);
            }

            sus.IncludeStartAndEndTags = false;
            ViewBag.StatusUpdateList = @"<ul id=""status_update_list_items"">" + sus.ToUnorderdList + @"</ul>";

            var pitm2 = new PhotoItem();

            pitm2.GetPreviousPhotoForUser(_pitm.CreateDate, _ua.UserAccountID);
            if (pitm2.PhotoItemID > 0)
            {
                pitm2.IsUserPhoto = true;
                pitm2.ShowTitle = false;
                pitm2.UseThumb = true;
                ViewBag.PreviousPhoto = pitm2;
            }

            pitm2 = new PhotoItem();
            pitm2.GetNextPhotoForUser(_pitm.CreateDate, _ua.UserAccountID);

            if (pitm2.PhotoItemID <= 0) return View(_pitm);

            pitm2.IsUserPhoto = true;
            pitm2.ShowTitle = false;
            pitm2.UseThumb = true;
            ViewBag.NextPhoto = pitm2;

            return View(_pitm);
        }