예제 #1
0
        public IActionResult Get(string language, string db, string path)
        {
            //Check language validity
            if (!_dbSource.Languages.Contains(language))
            {
                //TODO log invalid language
                return(NotFound());
            }

            //Check database validity
            if (db != _dbSource.DatabaseId)
            {
                //TODO log invalid database
                return(NotFound());
            }

            //Resolve metadata
            var item = _dbSource.GetMenu(db, language, path);

            if (item is PxMenuItem)
            {
                return(Ok(((PxMenuItem)item).GetMetaList().ToJSON(true)));
            }
            else if (item is TableLink)
            {
                var builder = _dbSource.GetBuilder(language, path);
                builder.SetPreferredLanguage(language);
                return(Ok(builder.GetTableMeta()));
            }

            //TODO serach for it
            return(NotFound());
        }