コード例 #1
0
        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());
        }
コード例 #2
0
        public async Task <IActionResult> RejectPhoto(int id)
        {
            await _photoService.DeletePhoto(id, false);

            return(Ok());
        }