Exemplo n.º 1
0
        public async Task <IActionResult> GetSchemas(string app)
        {
            var schemas = await appProvider.GetSchemasAsync(AppId);

            var response = SchemasDto.FromSchemas(schemas, this, app);

            Response.Headers[HeaderNames.ETag] = response.ToEtag();

            return(Ok(response));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> GetSchemas(string app)
        {
            var schemas = await appProvider.GetSchemasAsync(AppId);

            var response = Deferred.Response(() =>
            {
                return(SchemasDto.FromSchemas(schemas, Resources));
            });

            Response.Headers[HeaderNames.ETag] = schemas.ToEtag();

            return(Ok(response));
        }
Exemplo n.º 3
0
        public static BulkUpdateJob ToUpsert(this ContentModel model, SchemasDto schemas)
        {
            var result = SimpleMapper.Map(model, new BulkUpdateJob());

#pragma warning disable CS0618 // Type or member is obsolete
            var singleton = schemas.Items.Find(x => x.Name == model.Schema && (x.IsSingleton || x.Type == SchemaType.Singleton));
#pragma warning restore CS0618 // Type or member is obsolete
            if (singleton != null)
            {
                result.Id = singleton.Id;
            }

            result.Data = model.Data;

            return(result);
        }
Exemplo n.º 4
0
        public static BulkUpdateJob ToJob(this ContentModel model, SchemasDto schemas)
        {
            var id = model.Id;

#pragma warning disable CS0618 // Type or member is obsolete
            var singleton = schemas.Items.Single(x => x.Name == model.Schema && x.IsSingleton);
#pragma warning restore CS0618 // Type or member is obsolete
            if (singleton != null)
            {
                id = singleton.Id;
            }

            return(new BulkUpdateJob
            {
                Id = id,
                Data = model.Data,
                Schema = model.Schema,
                Status = model.Status,
                Type = BulkUpdateType.Upsert
            });
        }