public async Task <IActionResult> Index(string tinyCode) { TinyActionResult <Url> res = new TinyActionResult <Url>(); res = await _urlService.GetByIdAsync(tinyCode, true); if (res.IsSuccess) { return(Redirect(res.Data.SourceUrl)); } else { return(View("404")); } }
public async Task <TinyActionResult <UrlViewModel> > Get(string TinyCode) { var res = await _urlService.GetByIdAsync(TinyCode, false); return(new TinyActionResult <UrlViewModel>() { Data = (res.Data != null) ? new UrlViewModel() { Hit = res.Data.Hit, id = res.Data.id, SourceUrl = res.Data.SourceUrl, TinyCode = res.Data.TinyCode, TinyUrl = String.Format(BasicInfo.HostAddress, res.Data.TinyCode) } : null, IsSuccess = res.IsSuccess, Message = res.Message }); }
public async Task <ActionResult <AppointmentDto> > GetById([FromRoute] Guid id) { return(Ok(await _urlService.GetByIdAsync(id))); }