コード例 #1
0
        public async Task <IActionResult> EditPhoto(string Id)
        {
            var photo = await _photoRepo.GetPhoto(Id);

            var categories = _categoryRepo.GetCategories().Select(cat => new SelectListItem
            {
                Text  = cat.Name,
                Value = cat.Name
            }).ToList();

            if (photo == null)
            {
                return(RedirectToAction(nameof(Index)));
            }

            var model = new PhotoEditViewModel
            {
                Name          = photo.Name,
                Description   = photo.Description,
                PhotoUrl      = photo.PhotoUrl,
                Category      = photo.Category,
                FacebookLink  = photo.FaceBookLink,
                InstagramLink = photo.InstagramLink,
                TwitterLink   = photo.TwitterLink,
                Categories    = categories
            };

            return(View(model));
        }
コード例 #2
0
 public virtual Bitmap GetPhoto()
 {
     return(photo.GetPhoto());
 }
コード例 #3
0
        public IActionResult GetPhoto(uint id)
        {
            PhotoEntity photo = _photoService.GetPhoto(id);

            return((photo != null) ? Ok(photo) : NotFound());
        }