Beispiel #1
0
        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"));
            }
        }
Beispiel #2
0
        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
            });
        }
Beispiel #3
0
 public async Task <ActionResult <AppointmentDto> > GetById([FromRoute] Guid id)
 {
     return(Ok(await _urlService.GetByIdAsync(id)));
 }