Пример #1
0
        public async Task <HttpResponseMessage> GetSchemas(string schemaId = null)
        {
            if (string.IsNullOrWhiteSpace(schemaId))
            {
                return((await _SchemaService.GetSchemas())
                       .Let(schemata => SetMetaLocations(schemata, GetSchemasRouteName, schema => new { schemaId = schema.Id }))
                       .ToHttpResponseMessage(Request));
            }

            return((await _SchemaService.GetSchema(schemaId))
                   .Let(schema => SetMetaLocation(schema, GetSchemasRouteName, new { schemaId = schema.Id }))
                   .ToHttpResponseMessage(Request, (schema, response) => SetContentLocationHeader(response, GetSchemasRouteName, new { schemaId = schema.Id })));
        }