Exemplo n.º 1
0
        public async Task <ActionResult <LinkStatsDTO> > GetStatsOnLink(string shortlink)
        {
            var toReturn = await LinkmirLinkModel.GetLinkStats(_context, shortlink);

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

            toReturn.ShortLink = BuildLinkmirUrl(toReturn.ShortLink);
            return(toReturn);
        }
Exemplo n.º 2
0
        public async Task <ActionResult <LinkDTO> > GetLinkmirLink(string shortlink, bool?redirect = false)
        {
            var link = await LinkmirLinkModel.GetLinkStats(_context, shortlink);

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

            var toReturn = new LinkDTO
            {
                ShortLink = BuildLinkmirUrl(shortlink),
                Link      = link.Link
            };

            if (redirect.GetValueOrDefault())
            {
                return(Redirect(toReturn.Link));
            }
            else
            {
                return(toReturn);
            }
        }