コード例 #1
0
        public async Task <ActionResult <LinkBundle> > DeleteLinkBundleAsync(string vanityUrl)
        {
            string userHandle = _linksService.GetUserAccountEmail();

            if (string.IsNullOrEmpty(userHandle))
            {
                return(Unauthorized());
            }

            var linkBundle = await _linksService.FindLinkBundleAsync(vanityUrl);

            if (linkBundle == null)
            {
                return(NotFound());
            }

            try
            {
                await _linksService.RemoveLinkBundleAsync(linkBundle);
            }
            catch (Exception)
            {
                return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
            }

            return(NoContent());
        }