public async Task <IActionResult> ShortenLink([FromForm] string url) { var identity = _Identifier.GetOrCreateIdentity(HttpContext); var shortenResult = await _LinksShortener.ShortenAsync(url); var linkToAdd = new LinkModel { OriginalUrl = url, ShortenId = shortenResult, Identity = identity }; await _LinksRepository.AddLinkAsync(linkToAdd); var response = new AddLinkResponseModel { Identity = identity, Shorten = $"{HttpContext.Request.GetBaseUrl()}/l/{shortenResult}", Original = url }; return(Json(response)); }