예제 #1
0
 public IHttpActionResult Get(int id)
 {
     try
     {
         PagesModel page = _pagesService.GetAsync(id).Result;
         return(Ok(page));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
예제 #2
0
        public async Task OnGetAsync(string id)
        {
            var page = await _pagesService.GetAsync(id);

            if (page == null)
            {
                Title    = "404 Not Found";
                HtmlBody = "Unfortunately this page was not found.";
                return;
            }
            Id       = page.Id;
            Title    = page.Title;
            HtmlBody = page.HtmlBody;
        }
예제 #3
0
        public async Task OnGet(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                Images = new List <string>();
                return;
            }

            var page = await _pagesService.GetAsync(id);

            MapFromPage(page);

            Images = (await _imagesRepository.GetAllAsync(id)).Select(i => Path.GetFileName(i)).ToList();
        }