Ejemplo n.º 1
0
        public bool Update(LazyPI.Common.Connection Connection, LazyObjects.AFElementTemplate template)
        {
            WebAPIConnection webConnection = (WebAPIConnection)Connection;
            var request = new RestRequest("/elementtemplates/{webId}", Method.PATCH);

            request.AddUrlSegment("webId", template.WebID);
            ResponseModels.AFElementTemplate temp = new ResponseModels.AFElementTemplate(template.ID, template.WebID, template.Name, template.Description, template.Path);
            temp.AllowElementToExtend = template.IsExtendable;

            request.AddBody(temp);
            var statusCode = webConnection.Client.Execute(request).StatusCode;

            return((int)statusCode == 204);
        }
        public bool CreateElementTemplate(LazyPI.Common.Connection Connection, string ParentID, LazyObjects.AFElementTemplate Template)
        {
            WebAPIConnection webConnection = (WebAPIConnection)Connection;
            var request = new RestRequest("/elementtemplates/{webId}/attributetemplates", Method.POST);
            request.AddUrlSegment("webId", ParentID);

            ResponseModels.AFElementTemplate temp = new ResponseModels.AFElementTemplate();

            temp.WebID = temp.ID;
            temp.Name = Template.Name;
            temp.Description = Template.Description;
            temp.Path = Template.Path;
            temp.CategoryNames = Template.Categories.ToList();
            temp.AllowElementToExtend = Template.IsExtendable;

            request.AddBody(temp);

            var statusCode = webConnection.Client.Execute(request).StatusCode;

            return ((int)statusCode == 201);
        }
Ejemplo n.º 3
0
        public bool CreateElementTemplate(LazyPI.Common.Connection Connection, string ParentID, LazyObjects.AFElementTemplate Template)
        {
            WebAPIConnection webConnection = (WebAPIConnection)Connection;
            var request = new RestRequest("/elementtemplates/{webId}/attributetemplates", Method.POST);

            request.AddUrlSegment("webId", ParentID);

            ResponseModels.AFElementTemplate temp = new ResponseModels.AFElementTemplate();

            temp.WebId                = temp.Id;
            temp.Name                 = Template.Name;
            temp.Description          = Template.Description;
            temp.Path                 = Template.Path;
            temp.CategoryNames        = Template.Categories.ToList();
            temp.AllowElementToExtend = Template.IsExtendable;

            request.AddBody(temp);

            var statusCode = webConnection.Client.Execute(request).StatusCode;

            return((int)statusCode == 201);
        }