BIMToolkitAPIClient.Controllers.UniclassController.Index C# (CSharp) Method

Index() public method

public Index ( string notation, string lod, string loi ) : System.Web.Mvc.ActionResult
notation string
lod string
loi string
return System.Web.Mvc.ActionResult
        public ActionResult Index(string notation, string lod, string loi)
        {
            //generate link back to parent
            var parts = notation.Split('_');
            if(parts.Length <= 1)
            {
                ViewBag.BackLink = "/";
            }
            else
            {
                 ViewBag.BackLink = "/Uniclass?notation=" + string.Join("_", parts.Take(parts.Length -1));
            }

            //get information for current Unicalss notation
            var model = new ClassificationPage();
            var cn = ApiAccess.CallApi(string.Format("definitions/uniclass2015/{0}/1", notation));
            model.Classification = JsonConvert.DeserializeObject<ClassificationNode>(cn);

            //check querstring for specified lod and loi levels
            if (Request.QueryString["lod"] != null)
            {
                ViewBag.LodLevel = lod;
            }
            else if (model.Classification.Lods != null)
            {
                ViewBag.LodLevel = model.Classification.Lods.First();
            }
            else
            {
                ViewBag.LodLevel = "0";
            }
            if (Request.QueryString["loi"] != null)
            {
                ViewBag.LoiLevel = loi;
            }
            else if (model.Classification.Lois != null)
            {
                ViewBag.LoiLevel = model.Classification.Lois.First();
            }
            else
            {
                ViewBag.LoiLevel = "0";
            }

            //check if LOI definitions are available
            if (model.Classification.Lois != null)
            {
                //get json and deserialize
                var loiJson = ApiAccess.CallApi(string.Format("definitions/loi/{0}/{1}", notation, ViewBag.LoiLevel));
                var objectLoi = JsonConvert.DeserializeObject<Definition>(loiJson);

                //for this simple example, we are just going to send the raw json data back to the view with a bit of formatting
                model.Loi = JsonConvert.SerializeObject(objectLoi, Formatting.Indented);
            }

            return View(model);
        }
UniclassController