public async Task Delete(string id)
        {
            if (id.Equals(new CentralCertConfigId().Uuid))
            {
                await CentralCertHelper.Disable();
            }

            // Success
            Context.Response.StatusCode = (int)HttpStatusCode.NoContent;
        }
        public object Get(string id)
        {
            RequireEnabled();

            if (!id.Equals(new CentralCertConfigId().Uuid))
            {
                return(NotFound());
            }

            return(CentralCertHelper.ToJsonModel());
        }
        public object Patch(string id, [FromBody] dynamic model)
        {
            RequireEnabled();

            if (!id.Equals(new CentralCertConfigId().Uuid))
            {
                return(NotFound());
            }

            CentralCertHelper.Update(model, _fileProvider);

            return(CentralCertHelper.ToJsonModel());
        }
示例#4
0
        private void ConfigureCentralCerts()
        {
            Environment.Host.RouteBuilder.MapWebApiRoute(Defines.Resource.Guid, $"{Defines.PATH}/{{id?}}", new { controller = "CentralCerts" });

            Environment.Hal.ProvideLink(Defines.Resource.Guid, "self", cc => new { href = $"/{Defines.PATH}/{ new CentralCertConfigId().Uuid}" });
            Environment.Hal.ProvideLink(WebServer.Defines.Resource.Guid, Defines.Resource.Name, _ => new { href = CentralCertHelper.GetLocation() });
        }
        public async Task <object> Post([FromBody] dynamic model)
        {
            await CentralCertHelper.Enable(model, _fileProvider);

            return(CentralCertHelper.ToJsonModel());
        }
        public object Get()
        {
            RequireEnabled();

            return(LocationChanged(CentralCertHelper.GetLocation(), CentralCertHelper.ToJsonModel()));
        }