Exemplo n.º 1
0
 public IActionResult Delete(long id)
 {
     if (repo.Contains(id))
     {
         repo.Delete(id);
         return(NoContent());
     }
     else
     {
         return(NotFound());
     }
 }
Exemplo n.º 2
0
        public async Task Delete(Guid userId, Guid storyId)
        {
            var storyDB = await _storiesRepository.GetById(storyId);

            if (storyDB == null)
            {
                throw new ArgumentException("Story not found");
            }
            if (storyDB.UserId != userId)
            {
                throw new ArgumentException("Story doesn't belong to user");
            }

            await Task.WhenAll(_amazonS3Repository.Delete(storyId.ToString()),
                               _storiesRepository.Delete(storyId),
                               _feedService.DeleteStoryFromFeed(userId, storyDB));
        }