private dynamic GetJob() { var model = this.Bind <JobBindingModel>(); var vm = viewProjectionFactory.Get <JobBindingModel, JobViewModel>(model); return(Response.AsJson(new { success = vm.Success, model = vm.Model })); }
private void SetTagCloud(NancyContext obj) { ViewBag.TagCould = _viewFactory.Get <TagCloudBindingModel, TagCloudViewModel>(new TagCloudBindingModel() { Threshold = 2 }); }
private int GetNewJobCount() { var vm = viewProjectionFactory.Get <AllJobsBindingModel, AllJobsViewModel>(new AllJobsBindingModel { StartDate = DateTime.Now.GetStartDateTimeOfDay() }); return(vm.TotalCount); }
private dynamic GetPerformanceList() { var model = this.Bind <AllPerformancesBindingModel>(); var vm = viewProjectionFactory.Get <AllPerformancesBindingModel, AllPerformancesViewModel>(model); return(Response.AsJson(vm)); }
private Response SetCurrentUserToViewBag(NancyContext ctx) { var author = _viewProjectionFactory.Get <string, Author>(ctx.CurrentUser.UserName); ViewBag.CurrentUser = author; return(null); }
private dynamic GetRecentPostsRss() { var recentPosts = _viewProjectionFactory.Get <RecentBlogPostsBindingModel, RecentBlogPostsViewModel>(new RecentBlogPostsBindingModel() { Page = 1, Take = 30 }); return(new RssResponse(recentPosts.Posts, Settings.WebsiteName, new Uri(Settings.WebsiteUrl))); }
private Response SetCurrentUserToViewBag(NancyContext ctx) { var author = _viewProjectionFactory.Get <string, Author>(ctx.CurrentUser.UserName); if (author == null) { return(ctx.GetRedirect("/mz-login?returnUrl=" + Request.Url.Path).AddCookie(FormsAuthentication.CreateLogoutCookie())); } ViewBag.CurrentUser = author; return(null); }
private dynamic GetRecentPostsRss() { var cacheKey = "rss"; var rss = _cache.Get <RssResponse>(cacheKey); if (rss == null) { var recentPosts = _viewProjectionFactory.Get <RecentBlogPostsBindingModel, RecentBlogPostsViewModel>(new RecentBlogPostsBindingModel() { Page = 1, Take = 30 }); rss = new RssResponse(recentPosts.Posts, Settings.WebsiteName, new Uri(AppConfiguration.Current.SiteUrl)); _cache.Add(cacheKey, rss, 60 * 5); } return(rss); }
public static Tag AsTag(this string slug) { return(_viewFac.Get <string, Tag>(slug)); }
public static Tag AsTag(this string tag) { var slug = tag.ToSlug(); return(factory.Get <string, Tag>(slug)); }