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); }
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); } }