Esempio n. 1
0
        /// <summary>
        /// Execute JSON command to the database
        /// </summary>
        /// <param name="jsonCommand"></param>
        /// <param name="connectionId"></param>
        /// <returns></returns>
        public string ExecuteQuery(string jsonCommand = "", int connectionId = 0)
        {
            ISqlClient sqlClient = _Connections[connectionId];

            LinqQueryModel linqQuery = (LinqQueryModel)Helper.JsonDeserialize(jsonCommand, typeof(LinqQueryModel));
            string         result    = "";

            switch (linqQuery.command)
            {
            case "select":
                string dataResult = sqlClient.ExecuteReader(linqQuery);
                result = "{\"data\":" + dataResult + "}";
                break;

            default:
                result = "error";
                break;
            }
            return(result);
        }