public static LocalizedString AdaptiveCapture(string caption, string extension) { var result = NullLocalizer.Instance("{0}{1} {2}{3}", caption, new HtmlString("<span class=\"hidden-xs\">"), extension, new HtmlString("</span>")); return(result); }
public void StringsShouldPassThrough() { var result = NullLocalizer.Instance("hello world"); Assert.Equal(result.ToString(), "hello world"); }
public void StringsShouldNotFormatWithoutAnyArguments() { var result = NullLocalizer.Instance("hello {0} world"); Assert.Equal(result.ToString(), "hello {0} world"); }
public void StringsShouldFormatIfArgumentsArePassedIn() { var result = NullLocalizer.Instance("hello {0} world", "!"); Assert.Equal(result.ToString(), "hello ! world"); }
public IHttpActionResult Posts(int blogId, [FromUri] PagerParameters pagerParameters) { Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters); var blogPart = _blogService.Get(blogId, VersionOptions.Published).As <BlogPart>(); if (blogPart == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.ViewContent, blogPart, NullLocalizer.Instance("Cannot view content"))) { throw new HttpResponseException(HttpStatusCode.Unauthorized); } var posts = _blogPostService.Get(blogPart, pager.GetStartIndex(), pager.PageSize).Select(bp => new BlogPost { Id = bp.Id, Title = bp.Title, CreatedBy = bp.Creator.UserName, PublishedUtc = bp.PublishedUtc }).ToList(); return(Ok(posts)); }
public IHttpActionResult Get(int blogId) { var blogPart = _blogService.Get(blogId, VersionOptions.Published).As <BlogPart>(); if (blogPart == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } if (!_services.Authorizer.Authorize(Orchard.Core.Contents.Permissions.ViewContent, blogPart, NullLocalizer.Instance("Cannot view content"))) { throw new HttpResponseException(HttpStatusCode.Unauthorized); } var blog = new Blog { Id = blogPart.Id, Title = blogPart.Name, Description = blogPart.Description, PostCount = blogPart.PostCount }; return(Ok(blog)); }