public ActionResult Update(long photoId) { //Getting photo by photo Id and storing in a presentation object. PhotosPO mappedPhoto = PhotosMapper.MapDoToPO(dataAccess.ViewPhotoByPhotoId(photoId)); //Puts Album name and Id into viewbag as a list to use for a dropdown list in view. ViewBag.DropDown = new List <SelectListItem>(); List <AlbumDO> dataObjects = albumData.ReadAlbum(); try { foreach (AlbumDO item in dataObjects) { //Filling a SelectListItem with with all AlbumName and AlbumId properties. ViewBag.DropDown.Add(new SelectListItem() { Text = item.AlbumName, Value = item.AlbumId.ToString() }); } } catch (Exception ex) { //Logs exception using exceptionLog class. exceptionLog.ExceptionLog("Critical", ex.Message, "PhotosController", "Update", ex.StackTrace); } return(View(mappedPhoto)); }
public ActionResult Portfolio() { List<PhotosPO> mappedPhotos = new List<PhotosPO>(); ActionResult oResult = RedirectToAction("Index", "Home"); try { mappedPhotos = PhotosMapper.MapDoToPO(dataAccess.ViewPhotosById(4)); oResult = View(mappedPhotos); } catch (Exception ex) { //Logs exception using exceptionLog class. exceptionLog.ExceptionLog("Critical", ex.Message, "HomeController", "Portfolio", ex.StackTrace); } return oResult; }
public ActionResult Index(long albumId) { //Instanciating a list of photo objects to fill. List <PhotosPO> mappedItems = new List <PhotosPO>(); try { //Display photos that belong to user and provide actions to authenticated users. List <PhotosDO> dataObjects = dataAccess.ViewPhotosById(albumId); mappedItems = PhotosMapper.MapDoToPO(dataObjects); } catch (Exception ex) { //Logs exception using exceptionLog class. exceptionLog.ExceptionLog("Critical", ex.Message, "PhotosController", "Index", ex.StackTrace); TempData["Error"] = ex.Message; } return(View(mappedItems)); }