public AdminController(IHostingEnvironment hostingEnvironment, IMemoryCache memoryCache, IViewProjectionFactory viewProjectionFactory, ICommandInvokerFactory commandInvokerFactory) { this._hostingEnvironment = hostingEnvironment; this._memoryCache = memoryCache; this._viewProjectionFactory = viewProjectionFactory; this._commandInvokerFactory = commandInvokerFactory; }
public AccountController(IHostingEnvironment hostingEnvironment, IOptions <WebAppConfiguration> webAppConfiguration, IViewProjectionFactory viewProjectionFactory, ICommandInvokerFactory commandInvokerFactory) { this._hostingEnvironment = hostingEnvironment; this._webAppConfiguration = webAppConfiguration; this._viewProjectionFactory = viewProjectionFactory; this._commandInvokerFactory = commandInvokerFactory; }
public RssModule(IViewProjectionFactory viewProjectionFactory, ICache cache) { _viewProjectionFactory = viewProjectionFactory; _cache = cache; Get["/rss"] = _ => GetRecentPostsRss(); }
public FrontModule(IViewProjectionFactory viewFactory) { _viewFactory = viewFactory; After.AddItemToEndOfPipeline(SetRecentBlogPosts); After.AddItemToEndOfPipeline(SetTagCloud); }
public HomeModule(IViewProjectionFactory viewFactory, ISpamShieldService spamShield, ICommandInvokerFactory commandInvokerFactory) : base(viewFactory) { _viewFactory = viewFactory; _commandInvokerFactory = commandInvokerFactory; Get["/"] = p => ReturnHomeAction(new RecentBlogPostsBindingModel() { Page = 1, Take = 10 }); Get["/page/{page:int}"] = p => ReturnHomeAction(new RecentBlogPostsBindingModel() { Page = p.page, Take = 10 }); Get["/tag/{Tag}"] = p => ReturnArticlesTaggedBy(new TaggedBlogPostsBindingModel() { Tag = p.tag }); Get[@"/(?<year>\d{4})/(?<month>0[1-9]|1[0-2])/(?<titleslug>[a-zA-Z0-9_-]+)"] = p => ReturnArticle(new BlogPostDetailsBindingModel { Permalink = p.titleslug }, spamShield);//TODO:需要增加对日期有效性的验证 Get[@"/(?<year>\d{4})/(?<month>0[1-9]|1[0-2])"] = p => { var input = new IntervalBlogPostsBindingModel { FromDate = new DateTime(p.year, p.month, 1) }; input.ToDate = input.FromDate.AddMonths(1); return ReturnArticles(input); }; Post["/spam/hash/{tick}"] = p => spamShield.GenerateHash(p.tick); Post["/comment/(?<titleslug>[a-zA-Z0-9_-]+)"] = p => ReturnAddComment(p); }
public SecureModule(IViewProjectionFactory viewProjectionFactory) { _viewProjectionFactory = viewProjectionFactory; Before += SetContextUserFromAuthenticationCookie; Before += SetCurrentUserToViewBag; Before += SetCurrentUserToParamsForBindingPurposes; }
public FrontModule(IViewProjectionFactory viewFactory) { _viewFactory = viewFactory; After.AddItemToEndOfPipeline(SetRecentBlogPosts); After.AddItemToEndOfPipeline(SetTagCloud); After.AddItemToEndOfPipeline(NancyCompressionExtenstion.CheckForCompression); }
public AdminPostController(IHostingEnvironment hostingEnvironment, IOptions <WebAppConfiguration> webAppConfiguration, IMemoryCache memoryCache, IViewProjectionFactory viewProjectionFactory, ICommandInvokerFactory commandInvokerFactory) { this._hostingEnvironment = hostingEnvironment; this._webAppConfiguration = webAppConfiguration; this._memoryCache = memoryCache; this._viewProjectionFactory = viewProjectionFactory; this._commandInvokerFactory = commandInvokerFactory; }
public RssModule(IViewProjectionFactory viewProjectionFactory) { _viewProjectionFactory = viewProjectionFactory; Get["/rss"] = _ => GetRecentPostsRss(); Get["/feed"] = _ => GetRecentPostsRss(); this.EnableCache(); }
public PerformanceModule( IViewProjectionFactory viewProjectionFactory, ICommandInvokerFactory commandInvokerFactory) : base("/Performance") { this.viewProjectionFactory = viewProjectionFactory; this.commandInvokerFactory = commandInvokerFactory; Get["/"] = _ => View["List"]; Get["/GetPerformanceList"] = _ => GetPerformanceList(); }
public AccountController( IHostingEnvironment hostingEnvironment, IViewProjectionFactory viewProjectionFactory, ICommandInvokerFactory commandInvokerFactory, IOptions <AppConfig> appConfig) { this._hostingEnvironment = hostingEnvironment; this._viewProjectionFactory = viewProjectionFactory; this._commandInvokerFactory = commandInvokerFactory; this._appConfig = appConfig; }
public AdminModule(ICommandInvokerFactory commandInvokerFactory, IViewProjectionFactory viewProjectionFactory) : base(viewProjectionFactory) { _commandInvokerFactory = commandInvokerFactory; Get["/mz-admin"] = _ => Index(); Get["/mz-admin/change-password"] = _ => ChangePassword(); Post["/mz-admin/change-password"] = _ => ChangePassword(this.Bind <ChangePasswordCommand>()); Get["/mz-admin/change-profile"] = _ => ChangeProfile(); Post["/mz-admin/change-profile"] = _ => ChangeProfile(this.Bind <ChangeProfileCommand>()); }
public HomeController( IHostingEnvironment hostingEnvironment, IMemoryCache memoryCache, IViewProjectionFactory viewProjectionFactory, ICommandInvokerFactory commandInvokerFactory, IOptions <AppConfig> appConfig) { this._hostingEnvironment = hostingEnvironment; this._memoryCache = memoryCache; this._viewProjectionFactory = viewProjectionFactory; this._commandInvokerFactory = commandInvokerFactory; this._appConfig = appConfig; }
public AdminModule(ICommandInvokerFactory commandInvokerFactory, IViewProjectionFactory viewProjectionFactory, IRootPathProvider rootPath) : base(viewProjectionFactory) { _commandInvokerFactory = commandInvokerFactory; _rootPath = rootPath; Get["/mz-admin"] = _ => Index(); Get["/mz-admin/change-password"] = _ => ChangePassword(); Post["/mz-admin/change-password"] = _ => ChangePassword(this.Bind<ChangePasswordCommand>()); Get["/mz-admin/change-profile"] = _ => ChangeProfile(); Post["/mz-admin/change-profile"] = _ => ChangeProfile(this.Bind<ChangeProfileCommand>()); }
public HomeModule(IViewProjectionFactory viewFactory) : base(viewFactory) { Get["/"] = o => ReturnHomeAction(new RecentBlogPostsBindingModel() { Page = 1 }); Get["/page/{page?1}"] = o => ReturnHomeAction(new RecentBlogPostsBindingModel() { Page = o.page }); Get["/tagged/{Tag}"] = parameters => ReturnArticlesTaggedBy(new TaggedBlogPostsBindingModel() { Tag = parameters.tag }); Get["/{year}/{month}/{day}/{titleslug}"] = parameters => { if (Request.Url.Path.EndsWith("/")) { return(new RedirectResponse(Request.Url.Path.TrimEnd('/'), RedirectResponse.RedirectType.Permanent)); } return(ReturnArticle(new BlogPostDetailsBindingModel { Permalink = parameters .titleslug })); }; Get["/{year}/{month}/{day?}"] = parameters => { var day = parameters["day"] == null ? null : (int?)parameters.day; var input = new IntervalBlogPostsBindingModel { FromDate = new DateTime(parameters.year, parameters.month, parameters.day ?? 1) }; input.ToDate = day.HasValue ? input.FromDate.AddDays(1) : input.FromDate.AddMonths(1); return(ReturnArticles(input)); }; }
public AdminPostsModule(MongoDatabase database, IViewProjectionFactory factory, ICommandInvokerFactory commandInvokerFactory) : base(database, factory) { _commandInvokerFactory = commandInvokerFactory; Get["/admin/posts/{page?1}"] = _ => ShowPosts(_.page); Get["/admin/posts/new"] = _ => ShowNewPost(); Post["/admin/posts/new"] = _ => { var command = this.Bind <NewPostCommand>(); command.Author = CurrentUser; return(CreateNewPost(command)); }; Get["/admin/posts/edit/{postId}"] = _ => ShowPostDetails(_.postId); Post["/admin/posts/edit/{postid}"] = _ => EditPost(this.Bind <EditPostCommand>()); }
public HomeModule(IViewProjectionFactory viewProjectionFactory, ICommandInvokerFactory commandInvokerFactory) : base() { this.viewProjectionFactory = viewProjectionFactory; this.commandInvokerFactory = commandInvokerFactory; Get["/"] = _ => { ViewBag.NewJobCount = GetNewJobCount(); ViewBag.NewPerformanceCount = GetNewPerformanceCount(); return(View["Index"]); }; Get["/Home/GetJobPerformanceTrend"] = _ => GetJobPerformanceTrend(); }
public HomeModule(IViewProjectionFactory viewFactory, ISpamShieldService spamShield, ICommandInvokerFactory commandInvokerFactory) : base(viewFactory) { _viewFactory = viewFactory; _commandInvokerFactory = commandInvokerFactory; Get["/"] = p => ReturnHomeAction(new RecentBlogPostsBindingModel() { Page = 1, Take = 10 }); Get["/page/{page:int}"] = p => ReturnHomeAction(new RecentBlogPostsBindingModel() { Page = p.page, Take = 10 }); Get["/tag/{Tag}"] = p => ReturnArticlesTaggedBy(new TaggedBlogPostsBindingModel() { Tag = p.tag }); Get[@"/(?<year>\d{4})/(?<month>0[1-9]|1[0-2])/(?<titleslug>[a-zA-Z0-9_-]+)"] = p => ReturnArticle(new BlogPostDetailsBindingModel { Permalink = p.titleslug }, spamShield); //TODO:需要增加对日期有效性的验证 Get[@"/(?<year>\d{4})/(?<month>0[1-9]|1[0-2])"] = p => { var input = new IntervalBlogPostsBindingModel { FromDate = new DateTime(p.year, p.month, 1) }; input.ToDate = input.FromDate.AddMonths(1); return(ReturnArticles(input)); }; Post["/spam/hash/{tick}"] = p => spamShield.GenerateHash(p.tick); Post["/comment/(?<titleslug>[a-zA-Z0-9_-]+)"] = p => ReturnAddComment(p); }
public JobModule(IViewProjectionFactory viewProjectionFactory, ICommandInvokerFactory commandInvokerFactory) : base("/Job") { this.viewProjectionFactory = viewProjectionFactory; this.commandInvokerFactory = commandInvokerFactory; Get["/"] = _ => View["List", new { Url = IDPJobManagerConfiguration.Config.Provider.Uri.Trim('/', ' ') }]; Get["/GetJobList"] = _ => GetJobList(); Get["/Get"] = _ => GetJob(); Get["/GetJobDependency"] = _ => GetJobDependency(); Post["/Add"] = _ => AddJob(this.Bind <AddJobCommand>()); Post["/Edit"] = _ => EditJob(this.Bind <EditJobCommand>()); Post["/Delete"] = _ => DeleteJob(this.Bind <DeleteJobCommand>()); Post["/Start"] = _ => StartJob(this.Bind <StartJobCommand>()); Post["/Stop"] = _ => StopJob(this.Bind <StopJobCommand>()); Post["/SaveJobDependency"] = _ => SaveJobDependency(this.Bind <EditJobDependencyCommand>()); Post["/BatchOperate"] = _ => BatchOperate(this.Bind <BatchOperateJobCommand>()); Post["/Upload"] = _ => Upload(); }
public AdminPostsModule(IViewProjectionFactory factory, ICommandInvokerFactory commandInvokerFactory) : base(factory) { _commandInvokerFactory = commandInvokerFactory; Get["/mz-admin/posts/{page?1}"] = _ => ShowPosts(_.page); Get["/mz-admin/posts/new"] = _ => ShowNewPost(); Post["/mz-admin/posts/new"] = _ => { var command = this.Bind<NewPostCommand>(); command.Author = CurrentUser; return CreateNewPost(command); }; Get["/mz-admin/posts/edit/{postId}"] = _ => ShowPostEdit(_.postId); Post["/mz-admin/posts/edit/{postid}"] = _ => EditPost(this.Bind<EditPostCommand>()); Get["/mz-admin/posts/delete/{postid}"] = _ => DeletePost(this.Bind<DeletePostCommand>()); Get["/mz-admin/comment/{page?1}"] = _ => ShowComments(_.page); Get["/mz-admin/comment/delete/{commentid}"] = _ => DeleteComment(this.Bind<DeleteCommentCommand>()); Get["/mz-admin/tags"] = _ => ShowTags(); Post["/mz-admin/slug"] = _ => GetSlug(); }
public AdminPostsModule(IViewProjectionFactory factory, ICommandInvokerFactory commandInvokerFactory) : base(factory) { _commandInvokerFactory = commandInvokerFactory; Get["/mz-admin/posts/{page?1}"] = _ => ShowPosts(_.page); Get["/mz-admin/posts/new"] = _ => ShowNewPost(); Post["/mz-admin/posts/new"] = _ => { var command = this.Bind <NewPostCommand>(); command.Author = CurrentUser; return(CreateNewPost(command)); }; Get["/mz-admin/posts/edit/{postId}"] = _ => ShowPostEdit(_.postId); Post["/mz-admin/posts/edit/{postid}"] = _ => EditPost(this.Bind <EditPostCommand>()); Get["/mz-admin/posts/delete/{postid}"] = _ => DeletePost(this.Bind <DeletePostCommand>()); Get["/mz-admin/comments/{page?1}"] = _ => ShowComments(_.page); Get["/mz-admin/comments/delete/{commentid}"] = _ => DeleteComment(this.Bind <DeleteCommentCommand>()); Get["/mz-admin/tags"] = _ => ShowTags(); Post["/mz-admin/slug"] = _ => GetSlug(); }
public AdminModule(ICommandInvokerFactory commandInvokerFactory, MongoDatabase database, IViewProjectionFactory viewProjectionFactory, IRootPathProvider rootPath) : base(database, viewProjectionFactory) { _commandInvokerFactory = commandInvokerFactory; _rootPath = rootPath; Get["/admin"] = _ => Index(); Get["/admin/changepassword"] = _ => ChangePassword(); Post["/admin/changepassword"] = _ => ChangePassword(this.Bind <ChangePasswordCommand>()); Post["/admin/uploadFile"] = _ => UploadFile(Request.Files.First()); }
public static void SetupViewProjectionFactory(IViewProjectionFactory fac) { _viewFac = fac; }