Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • John Churchley 272 posts 1257 karma points c-trib
    Nov 20, 2015 @ 14:05
    John Churchley
    0

    Get list specific pages of known document type based on user language

    How to get a list of nodes of type document type "inspire" though an UmbracoApiController?

    Culture is passed through the query string

    ENGLISH - Inspire Node SPANISH - Inspire Node

        public class InspirationController : UmbracoApiController
    {
        // GET: Inspiration
        ///Umbraco/API/Inspire/All/?culture=
        [System.Web.Http.HttpGet]
        public IHttpActionResult All(string Culture)
        {
            if(Culture ==null){
                return NotFound();
            }
            System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo(Culture);
    
          ????
    
            return Json("");
        }
    
    }
    
  • John Churchley 272 posts 1257 karma points c-trib
    Nov 20, 2015 @ 14:15
    John Churchley
    100

    Was been silly used the UmbracoHelper.

     [System.Web.Http.HttpGet]
                public IHttpActionResult All(string Culture)
                {
                    if(Culture ==null){
                        return NotFound();
                    }
                    UmbracoHelper helper = new UmbracoHelper(UmbracoContext.Current);
    
                    foreach (var a in helper.TypedContentAtRoot())
                    {
                        if (a.GetCulture().ToString() == Culture)
                        {
                            return Json(a.Id);
    
                        }
    
                    }
    
                    return NotFound();
                }
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies