Ejemplo n.º 1
0
 public UrlApiController(IShortenUrlService shotenUrlService, IMapper mapper)
 {
     _shotenUrlService = shotenUrlService;
     _mapper           = mapper;
 }
Ejemplo n.º 2
0
        public async Task <ActionResult <UrlStatsViewModel> > GetCodeStats(string code, [FromServices] IShortenUrlService shortenUrlService)
        {
            var result = await shortenUrlService.GetStatsByCode(code);

            return(Ok(result));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Get(string code, [FromServices] IShortenUrlService shortenUrlService)
        {
            var location = await shortenUrlService.GetUrlByCode(code);

            return(Redirect(location));
        }
Ejemplo n.º 4
0
        public async Task <ActionResult <ShortUrlCreatedViewModel> > CreateShortenUrl(ShortenUrlDTO shortenUrlDTO, [FromServices] IShortenUrlService shortenUrlService)
        {
            var code = await shortenUrlService.CreateShortenUrl(shortenUrlDTO);

            return(Created(string.Empty, code));
        }
Ejemplo n.º 5
0
 public ShortenUrlController(IShortenUrlService shortenUrlService)
 {
     _shortenUrlService = shortenUrlService;
 }
Ejemplo n.º 6
0
 public UrlShortenerController(IShortenUrlService service)
 {
     _service = service;
 }