// 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)); }
/// <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)); }
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)); }