コード例 #1
0
        public async Task <IActionResult> DeleteRecord(string key)
        {
            try
            {
                Guard.ArgumentNotNullOrEmpty(nameof(key), key);
                var tenant = FetchTenantFromUser();
                await _urlShortenerService.RemoveShortUrlAsync(key, tenant);

                var jsonResult = new JsonResult("deleted")
                {
                    StatusCode = StatusCodes.Status200OK
                };
                return(jsonResult);
            }
            catch (Exception e)
            {
                _logger.LogError(e.Message);
            }
            return(new BadRequestObjectResult("Invalid Request"));
        }