public async Task <IActionResult> DeletePhoto(int userId, int id) { var currentUserId = int.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value); if (userId != currentUserId) { return(Unauthorized()); } var user = await _repo.GetUser(userId, userId == currentUserId); if (!user.Photos.Any(p => p.Id == id)) { return(Unauthorized()); } await _photoService.DeletePhoto(id); return(Ok()); }
public async Task <IActionResult> RejectPhoto(int id) { await _photoService.DeletePhoto(id, false); return(Ok()); }