Exemple #1
0
        public async Task <IHttpActionResult> Filter(FilterModel model)
        {
            var meta = await db.META_BO.FindAsync(model.MetaBoID);

            Logger.Info(model.MetaBoID + " : " + meta.BO_DB_NAME);
            /* ACCESS RIGHTS */
            try
            {
                UserRoleManager.Instance.VerifyRead(meta.BO_DB_NAME);
            }
            catch (UnauthorizedAccessException ex)
            {
                return(Content(HttpStatusCode.Forbidden, ex.Message));
            }
            /* FIN ACCESS RIGHTS */

            if (meta == null)
            {
                return(BadRequest());
            }


            var    s         = new SGBD();
            var    Gen       = new BORepositoryGenerator();
            string reqSelect = Gen.GenSelect(meta.BO_DB_NAME) + " where 1=1 " + model.Format();
            var    dt        = s.Cmd(reqSelect, model.mapping);


            return(Ok(dt));
            //return Ok();
        }