public async Task <IActionResult> Index(GetPage.Query query) { string path = $"./Features/Public/Page/{query.Filename}.cshtml"; if (System.IO.File.Exists(path)) { return(View(path)); } GetPage.Response response; try { response = await _mediator.Send(query); } catch (RecordNotFoundException) { HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound; return(View("~/Features/Public/Page/notfound.cshtml")); } return(View(new PageDetailViewModel { PageDetail = response?.PageDetail })); }
public async Task <IActionResult> Index(GetPage.Query query) { // TODO: Check to see if view exists on disk, if not then load from DB /*return View($"~/Features/Public/Page/{query.Filename}.cshtml");*/ GetPage.Response response; try { response = await _mediator.Send(query); } catch (RecordNotFoundException) { HttpContext.Response.StatusCode = (int)HttpStatusCode.NotFound; return(View("~/Features/Public/Page/notfound.cshtml")); } return(View(new PageDetailViewModel { PageDetail = response?.PageDetail })); }