public IHttpActionResult Get(int id) { try { PagesModel page = _pagesService.GetAsync(id).Result; return(Ok(page)); } catch (Exception ex) { return(InternalServerError(ex)); } }
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; }
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(); }