예제 #1
0
        public ResultSerialResponse HandleGet(string entitySetName, QueryParams queryParams)
        {
            entitySetName = ApiProviderDtoUtils.FixEntitySetNameCase(entitySetName, this.metadataSrv);
            var queryObject          = QueryUtils.RenderQueryObject(queryParams);
            var entityTypeName       = ApiProviderDtoUtils.GetEntityTypeName(entitySetName, this.metadataSrv);
            var resultSerialResponse = this.resultSerialUtils.FetchResponseData(entityTypeName, queryObject);

            return(resultSerialResponse);
        }
예제 #2
0
        public List <ResultSingleSerialData> HandleInsertEntityBatch(string entitySetName, IEnumerable <Dto> dtos)
        {
            entitySetName = ApiProviderDtoUtils.FixEntitySetNameCase(entitySetName, this.metadataSrv);
            var entityTypeName = ApiProviderDtoUtils.GetEntityTypeName(entitySetName, this.metadataSrv);

            if (!ApiProviderDtoUtils.ValidKeys(entityTypeName, dtos, this.metadataSrv))
            {
                throw new DtosException(code: 400, message: "Bad Request");
            }
            var resultSingleSerialDataList = this.dataViewDto.InsertItems(entityTypeName, dtos);

            return(resultSingleSerialDataList);
        }
예제 #3
0
        public ResultSingleSerialData HandleInsertEntity(string entitySetName, Dto dto)
        {
            entitySetName = ApiProviderDtoUtils.FixEntitySetNameCase(entitySetName, this.metadataSrv);
            var entityTypeName = ApiProviderDtoUtils.GetEntityTypeName(entitySetName, this.metadataSrv);

            if (!ApiProviderDtoUtils.ValidDtoKey(entityTypeName, dto, this.metadataSrv))
            {
                throw new DtosException(code: 400, message: "Bad Request");
            }
            var resultSingleSerialData = this.dataViewDto.InsertItem(entityTypeName, dto);

            return(resultSingleSerialData);
        }
예제 #4
0
        public ResultSerialData HandleGetMany(string entitySetName, QueryParams queryParams)
        {
            entitySetName = ApiProviderDtoUtils.FixEntitySetNameCase(entitySetName, this.metadataSrv);
            var queryObject    = QueryUtils.RenderQueryObject(queryParams);
            var entityTypeName = ApiProviderDtoUtils.GetEntityTypeName(entitySetName, this.metadataSrv);

            if (queryObject.Keys == null || queryObject.Keys.Count() == 0 || !ApiProviderDtoUtils.ValidKeys(entityTypeName, queryObject.Keys, this.metadataSrv))
            {
                throw new DtosException(code: 400, message: "Bad Request");
            }
            var resultSerialData = this.dataViewDto.GetMultipleItems(entityTypeName, queryObject.Keys, queryObject.Expand);

            return(resultSerialData);
        }
예제 #5
0
        public ResultSingleSerialData HandleDeleteEntity(string entitySetName, QueryParams queryParams)
        {
            entitySetName = ApiProviderDtoUtils.FixEntitySetNameCase(entitySetName, this.metadataSrv);
            var queryObject    = QueryUtils.RenderQueryObject(queryParams);
            var entityTypeName = ApiProviderDtoUtils.GetEntityTypeName(entitySetName, this.metadataSrv);

            if (queryObject.Keys == null || queryObject.Keys.Count() != 1 || !ApiProviderDtoUtils.ValidDtoKey(entityTypeName, queryObject.Keys.FirstOrDefault(), this.metadataSrv))
            {
                throw new DtosException(code: 400, message: "Bad Request");
            }
            var resultSingleSerialData = this.dataViewDto.DeleteItem(entityTypeName, queryObject.Keys.FirstOrDefault());

            return(resultSingleSerialData);
        }