using System.Text; using CTA.WebForms.FileInformationModel; namespace CTA.WebForms.Services { public class AppRazorService { private const string FileName = "App.razor"; private const string AppRazorTemplate = @"

Page not found

Sorry, but there's nothing here!

"; private const string DefaultLayoutAttrTemplate = "DefaultLayout=\"typeof({0})\""; public string DefaultLayout { get; set; } public FileInformation ConstructAppRazorFile() { // TODO: Allow modification of content var attrs = string.IsNullOrEmpty(DefaultLayout) ? string.Empty : string.Format(DefaultLayoutAttrTemplate, DefaultLayout); var fileContents = string.Format(AppRazorTemplate, attrs); var fileBytes = Encoding.UTF8.GetBytes(fileContents); return new FileInformation(FileName, fileBytes); } } }