public IActionResult Share(string albumId, string imgId)
        {
            ShareViewModel vm = new ShareViewModel();

            try
            {
                if (!String.IsNullOrEmpty(albumId))
                {
                    int AlbumId = Convert.ToInt32(Protector.Unprotect(albumId));
                    vm.Album = albums.GetById(AlbumId);
                }
                else if (!String.IsNullOrEmpty(imgId))
                {
                    int img = Convert.ToInt32(Protector.Unprotect(imgId));
                    vm.Photo = photoRepository.GetById(img);
                }
                else
                {
                    return(BadRequest("URL is not correct"));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest("URL is not correct"));
            }
            return(View(vm));
        }
示例#2
0
        public IActionResult PhotoDetail(int id)
        {
            var photo = _photoService.GetById(id);
            var model = new PhotoDetailModel()
            {
                Id      = photo.Id,
                Title   = photo.Title,
                Created = photo.DateCreated,
                Url     = photo.Url,
                Tags    = photo.Tags.Select(t => t.Description).ToList()
            };

            return(View(model));
        }
示例#3
0
        public ActionResult EditPhoto(int id)
        {
            var info = _photo.GetById(id);

            return(View(info));
        }
 public IActionResult Photo(int id)
 {
     return(Ok(photoRepo.GetById(id)));
 }