public async Task WhenAsync(MergePatchRolePermissionDto c)
        {
            var idObj         = RolePermissionProxyUtils.ToIdString((c as IMergePatchRolePermission).Id);
            var uriParameters = new RolePermissionUriParameters();

            uriParameters.Id = idObj;

            var req  = new RolePermissionPatchRequest(uriParameters, (MergePatchRolePermissionDto)c);
            var resp = await _ramlClient.RolePermission.Patch(req);

            RolePermissionProxyUtils.ThrowOnHttpResponseError(resp);
        }
        public async virtual Task <long> GetCountAsync(ICriterion filter)
        {
            var q = new RolePermissionsCountGetQuery();

            q.Filter = RolePermissionProxyUtils.GetFilterQueryValueString(filter);
            var req = new RolePermissionsCountGetRequest();

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

            RolePermissionProxyUtils.ThrowOnHttpResponseError(resp);
            return(long.Parse(await resp.RawContent.ReadAsStringAsync()));
        }
        public async Task <IRolePermissionStateEvent> GetStateEventAsync(RolePermissionId id, long version)
        {
            var idObj         = RolePermissionProxyUtils.ToIdString(id);
            var uriParameters = new RolePermissionStateEventUriParameters();

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

            var req  = new RolePermissionStateEventGetRequest(uriParameters);
            var resp = await _ramlClient.RolePermissionStateEvent.Get(req);

            RolePermissionProxyUtils.ThrowOnHttpResponseError(resp);
            return(resp.Content);
        }
        public async Task <IRolePermissionState> GetAsync(RolePermissionId id)
        {
            IRolePermissionState state = null;
            var idObj         = RolePermissionProxyUtils.ToIdString(id);
            var uriParameters = new RolePermissionUriParameters();

            uriParameters.Id = idObj;

            var req = new RolePermissionGetRequest(uriParameters);

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

            RolePermissionProxyUtils.ThrowOnHttpResponseError(resp);
            state = resp.Content;
            return(state);
        }
        public async Task <IEnumerable <IRolePermissionState> > GetAsync(ICriterion filter, IList <string> orders = null, int firstResult = 0, int maxResults = int.MaxValue, IList <string> fields = null)
        {
            IEnumerable <IRolePermissionState> states = null;
            var q = new RolePermissionsGetQuery();

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

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

            RolePermissionProxyUtils.ThrowOnHttpResponseError(resp);
            states = resp.Content;
            return(states);
        }
        public async Task WhenAsync(DeleteRolePermissionDto c)
        {
            var idObj         = RolePermissionProxyUtils.ToIdString((c as IDeleteRolePermission).Id);
            var uriParameters = new RolePermissionUriParameters();

            uriParameters.Id = idObj;

            var q = new RolePermissionDeleteQuery();

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

            var req = new RolePermissionDeleteRequest(uriParameters);

            req.Query = q;

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

            RolePermissionProxyUtils.ThrowOnHttpResponseError(resp);
        }