Exemplo n.º 1
0
        private async Task <URL> AddURLToDatabase(string shortUrlId, string normalizedLongUrl)
        {
            var newUrl = new URL
            {
                Created    = DateTime.Now,
                Identifier = shortUrlId,
                LongURL    = normalizedLongUrl,
                ShortURL   = $"shortify.link/{shortUrlId}"
            };

            await Context.AddAsync(newUrl);

            await Context.SaveChangesAsync();

            return(newUrl);
        }