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); }
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); }
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); }
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); }
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); }