Ejemplo n.º 1
0
        public async Task <IEnumerable <GetActionOutput> > GetActionServices(QueryActionInput query)
        {
            var sqlParams = new Dictionary <string, object>();
            var sql       = "SELECT * FROM  Action  WHERE EnableAuthorization=@EnableAuthorization AND AllowPermission=@AllowPermission";

            sqlParams.Add("EnableAuthorization", 1);
            sqlParams.Add("AllowPermission", 0);
            if (!query.ServiceHost.IsNullOrEmpty())
            {
                sql += " AND ServiceHost=@ServiceHost";
                sqlParams.Add("ServiceHost", query.ServiceHost);
            }
            if (!query.AppService.IsNullOrEmpty())
            {
                sql += " AND Application=@AppService";
                sqlParams.Add("AppService", query.AppService);
            }
            if (!query.Service.IsNullOrEmpty())
            {
                sql += " AND (ServiceId=@Service OR Name=@Service)";
                sqlParams.Add("Service", query.Service);
            }
            if (query.Ids != null)
            {
                sql += " AND Id IN @Ids";
                sqlParams.Add("Ids", query.Ids);
            }
            using (Connection)
            {
                var serviceActions = await Connection.QueryAsync <Action>(sql, sqlParams);

                return(serviceActions.MapTo <IEnumerable <GetActionOutput> >());
            }
        }
Ejemplo n.º 2
0
 public async Task <IEnumerable <GetActionOutput> > GetServices(QueryActionInput query)
 {
     query.CheckDataAnnotations().CheckValidResult();
     return(await _actionDomainService.GetActionServices(query));
 }