public async Task <IActionResult> OnPost(int photoId) { var pic = await _dataAccess.GetPictureAsync(photoId); var userId = User.FindFirst("userId"); if (userId.Value == pic.User_Id) { await _dataAccess.DeletePictureAsync(photoId); await _search.DeletePhotoAsync(photoId); await _caching.DeletePictureAsync(photoId); } return(RedirectToPage("/Gallery/Index")); }