public override ILiaraViewTemplate ResolveView(ILiaraContext context) { var viewName = context.Response.Format.View; if (viewName == null) { if (context.Route != null) { viewName = context.Route.Id.ToString(); } } var result = new LiaraViewTemplate(viewName, null); if (service.HasTemplate(viewName)) { return(result); } var templateString = ViewProvider.GetView(context); if (templateString == null) { context.Response.Status = LiaraHttpStatus.NoViewAssociated; return(ResolveInternalView(context)); } service.GetTemplate(templateString, context.Response.Content, viewName); return(result); }
public override ILiaraViewTemplate ResolveInternalView(ILiaraContext context) { if (context.Response.Status.Code != LiaraHttpStatus.OK.Code) { var viewName = "_liara_" + context.Response.Status.Code; var result = new LiaraViewTemplate(viewName, null, true); if (service.HasTemplate(viewName)) { return(result); } var templateString = ViewProvider.GetInternalView(context); service.GetTemplate(templateString, new ErrorMessage(), viewName); return(result); } return(null); }