Esempio n. 1
0
 public RazorPage(RazorFormat razorFormat, string fullPath, string name, string contents, RazorPageType pageType)
     : this()
 {
     RazorFormat = razorFormat;
     FilePath    = fullPath;
     Name        = name;
     Contents    = contents;
     PageType    = pageType;
 }
Esempio n. 2
0
        public override void ProcessRequest(IHttpRequest httpReq, IHttpResponse httpRes, string operationName)
        {
            var contentPage = RazorPage;

            if (contentPage == null)
            {
                var pageFilePath = this.FilePath.WithoutExtension();
                contentPage = RazorFormat.GetContentPage(pageFilePath);
            }
            if (contentPage == null)
            {
                httpRes.StatusCode = (int)HttpStatusCode.NotFound;
                return;
            }

            RazorFormat.ReloadModifiedPageAndTemplates(contentPage);

            if (httpReq.DidReturn304NotModified(contentPage.GetLastModified(), httpRes))
            {
                return;
            }

            RazorFormat.ProcessRazorPage(httpReq, contentPage, null, httpRes);
        }
Esempio n. 3
0
 public RazorPage(RazorFormat razorFormat, string fullPath, string name, string contents)
     : this(razorFormat, fullPath, name, contents, RazorPageType.ViewPage)
 {
 }
Esempio n. 4
0
        public string RenderToString <T>(T model)
        {
            var template = RazorFormat.ExecuteTemplate(model, this.PageName, this.TemplatePath);

            return(template.Result);
        }