public object Patch(string id, dynamic model)
        {
            LoggingId logId = new LoggingId(id);

            Site site = logId.SiteId == null ? null : SiteHelper.GetSite(logId.SiteId.Value);

            if (logId.SiteId != null && site == null)
            {
                Context.Response.StatusCode = (int)HttpStatusCode.NotFound;
                return(null);
            }

            if (model == null)
            {
                throw new ApiArgumentException("model");
            }

            // Check for config_scope
            string configScope = model == null ? null : ManagementUnit.ResolveConfigScope(model);

            LoggingHelper.Update(model, _fileProvider, site, logId.Path, configScope);

            ManagementUnit.Current.Commit();

            return(LoggingHelper.ToJsonModel(site, logId.Path));
        }
        public object Get(string id)
        {
            LoggingId logId = new LoggingId(id);

            Site site = logId.SiteId == null ? null : SiteHelper.GetSite(logId.SiteId.Value);

            if (logId.SiteId != null && site == null)
            {
                return(NotFound());
            }

            return(LoggingHelper.ToJsonModel(site, logId.Path));
        }
        public async Task <object> Post()
        {
            if (LoggingHelper.IsHttpEnabled() && LoggingHelper.IsCustomEnabled())
            {
                throw new AlreadyExistsException(DISPLAY_NAME);
            }

            await LoggingHelper.SetFeatureEnabled(true);

            dynamic settings = LoggingHelper.ToJsonModel(null, null);

            return(Created(LoggingHelper.GetLocation(settings.id), settings));
        }
예제 #4
0
        public object Get(string id)
        {
            LoggingId logId = new LoggingId(id);

            Site site = logId.SiteId == null ? null : SiteHelper.GetSite(logId.SiteId.Value);

            if (logId.SiteId != null && site == null)
            {
                return(new StatusCodeResult((int)HttpStatusCode.NotFound));
            }

            return(LoggingHelper.ToJsonModel(site, logId.Path));
        }
        public object Get()
        {
            Site   site = SiteHelper.ResolveSite();
            string path = SiteHelper.ResolvePath();

            if (path == null)
            {
                return(NotFound());
            }

            dynamic d = LoggingHelper.ToJsonModel(site, path);

            return(LocationChanged(LoggingHelper.GetLocation(d.id), d));
        }