public IActionResult DeletePhoto(int?photoId, int?albumId) { if (photoId == null || albumId == null) { return(NotFound()); } photoService.RemovePhoto(photoId.Value); return(RedirectToAction("Album", new { albumId })); }
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 })); }