示例#1
0
        public async Task WhenAsync(MergePatchRoleDto c)
        {
            var idObj         = (c as IMergePatchRole).RoleId;
            var uriParameters = new RoleUriParameters();

            uriParameters.Id = idObj;

            var req  = new RolePatchRequest(uriParameters, (MergePatchRoleDto)c);
            var resp = await _ramlClient.Role.Patch(req);

            RoleProxyUtils.ThrowOnHttpResponseError(resp);
        }
示例#2
0
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new RolesCountGetQuery();

            q.Filter = RoleProxyUtils.GetFilterQueryValueString(filter);
            var req = new RolesCountGetRequest();

            req.Query = q;
            var resp = await _ramlClient.RolesCount.Get(req);

            RoleProxyUtils.ThrowOnHttpResponseError(resp);
            return(long.Parse(await resp.RawContent.ReadAsStringAsync()));
        }
示例#3
0
        public async Task <IRoleStateEvent> GetStateEventAsync(string roleId, long version)
        {
            var idObj         = roleId;
            var uriParameters = new RoleStateEventUriParameters();

            uriParameters.Id      = idObj;
            uriParameters.Version = version.ToString();

            var req  = new RoleStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.RoleStateEvent.Get(req);

            RoleProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
示例#4
0
        public async Task <IRoleState> GetAsync(string roleId)
        {
            IRoleState state         = null;
            var        idObj         = roleId;
            var        uriParameters = new RoleUriParameters();

            uriParameters.Id = idObj;

            var req = new RoleGetRequest(uriParameters);

            var resp = await _ramlClient.Role.Get(req);

            RoleProxyUtils.ThrowOnHttpResponseError(resp);
            state = resp.Content;
            return(state);
        }
示例#5
0
        public async Task <IEnumerable <IRoleState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IRoleState> states = null;
            var q = new RolesGetQuery();

            q.FirstResult = firstResult;
            q.MaxResults  = maxResults;
            q.Sort        = RoleProxyUtils.GetOrdersQueryValueString(orders);
            q.Fields      = RoleProxyUtils.GetReturnedFieldsQueryValueString(fields, QueryFieldValueSeparator);
            q.Filter      = RoleProxyUtils.GetFilterQueryValueString(filter);
            var req = new RolesGetRequest();

            req.Query = q;
            var resp = await _ramlClient.Roles.Get(req);

            RoleProxyUtils.ThrowOnHttpResponseError(resp);
            states = resp.Content;
            return(states);
        }
示例#6
0
        public async Task WhenAsync(DeleteRoleDto c)
        {
            var idObj         = (c as IDeleteRole).RoleId;
            var uriParameters = new RoleUriParameters();

            uriParameters.Id = idObj;

            var q = new RoleDeleteQuery();

            q.CommandId   = c.CommandId;
            q.RequesterId = c.RequesterId;
            q.Version     = Convert.ToString(c.Version);

            var req = new RoleDeleteRequest(uriParameters);

            req.Query = q;

            var resp = await _ramlClient.Role.Delete(req);

            RoleProxyUtils.ThrowOnHttpResponseError(resp);
        }