public async Task Remove(ShortUrlRemoveRequest shortUrlRemoveRequest)
        {
            var shortUrlModel = await _shortUrlRepository.FirstOrDefault(x =>
                                                                         x.Id == shortUrlRemoveRequest.Id && x.CreatorId == shortUrlRemoveRequest.UserId);

            if (shortUrlModel == null)
            {
                throw new ShortUrlNotFoundException();
            }
            await _shortUrlRepository.Remove(shortUrlModel);

            await _shortUrlLogEntryRepository.RemoveLogs(shortUrlModel.Id);
        }
示例#2
0
 public void DeleteById(int id)
 {
     _shortUrlRepository.Remove(id);
 }