Ejemplo n.º 1
0
        // GET: Photo/Details/5
        public ActionResult Details(int id)
        {
            var photo    = db.Photos.Find(id);
            var newPhoto = new DisplayPhotosViewModel()
            {
                Id          = photo.PhotoID,
                Description = photo.PhotoDesc,
                Title       = photo.PhotoTitle,
                Date        = photo.TimeStamp
            };

            return(View(newPhoto));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets photos for gallery
        /// </summary>
        /// <returns></returns>
        public ActionResult _ImageGallery()
        {
            var vm = new PhotoGalleryViewModel
            {
                Photos = new List <DisplayPhotosViewModel>()
            };
            var photos = db.Photos.Where(x => x.InLandingPageCarousel == true);

            foreach (var i in photos)
            {
                var photoToAdd = new DisplayPhotosViewModel()
                {
                    Id          = i.PhotoID,
                    Data        = i.PhotoData,
                    Description = i.PhotoDesc,
                    Title       = i.PhotoTitle,
                    Credit      = i.Credit
                };
                vm.Photos.Add(photoToAdd);
            }

            return(View(vm));
        }
Ejemplo n.º 3
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var photo = db.Photos.Find(id);
            var vm    = new DisplayPhotosViewModel()
            {
                Id          = photo.PhotoID,
                Date        = photo.TimeStamp,
                Description = photo.PhotoDesc,
                Title       = photo.PhotoTitle,
                Data        = photo.PhotoData
            };

            if (photo == null)
            {
                return(HttpNotFound());
            }

            return(View(vm));
        }