예제 #1
0
        public async Task <IActionResult> OnPostDelete(int id)
        {
            try
            {
                var shortenedUrl = await _urlShortenerService.DeleteById(id);

                StatusMessage = $"{shortenedUrl.ShortUrl} has been deleted!";
                return(RedirectToPage());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "OnPostDelete: Unable to find ShortenedUrl {Id}", id);
                StatusMessage = $"Error: Something went wrong retrieving Shortened Url Token {id}.";
                return(Page());
            }
        }