public async Task <IActionResult> Remove([FromBody] ShortUrlRemoveRequest shortUrlRemoveRequest) { shortUrlRemoveRequest.UserId = _currentLoginUser.AccountId; await _shortUrlService.Remove(shortUrlRemoveRequest); return(Ok()); }
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); }