public async Task <ActionResult> LookupCode(string code) { var shrtUrlEntity = await _shrtUrlRepo.LookupShrtUrl(code); if (shrtUrlEntity == null) { return(new NotFoundResult()); } await _shrtUrlRepo.IncrementClicks(shrtUrlEntity); return(new RedirectResult(shrtUrlEntity.Url)); }
public async Task <ActionResult> GetStats(string code) { if (code == null) { return(new BadRequestResult()); } var shrtUrlEntity = await _shrtnUrlRepo.LookupShrtUrl(code); if (shrtUrlEntity == null) { return(new NotFoundResult()); } return(new OkObjectResult(new ShrtUrlDto().FromShrtUrlEntity(shrtUrlEntity))); }