public IActionResult Delete(long id) { if (repo.Contains(id)) { repo.Delete(id); return(NoContent()); } else { return(NotFound()); } }
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)); }