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

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

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

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