コード例 #1
0
 public IActionResult DeletePhoto(int?photoId, int?albumId)
 {
     if (photoId == null || albumId == null)
     {
         return(NotFound());
     }
     photoService.RemovePhoto(photoId.Value);
     return(RedirectToAction("Album", new { albumId }));
 }
コード例 #2
0
        public IActionResult RemovePhoto(int?photoId, int?albumId)
        {
            if (photoId == null || albumId == null)
            {
                return(NotFound());
            }
            if (!photoService.HasThisPhoto(photoId.Value, currentUser.Id))
            {
                return(ForbidView());
            }

            photoService.RemovePhoto(photoId.Value);

            return(RedirectToAction("Album", new { albumId = albumId.Value }));
        }