Ejemplo n.º 1
0
        public void Put(string classCode, int id, [FromBody] JObject @object)
        {
            ObjectManipulator objectManipulator = new ObjectManipulator(this);

            objectManipulator.BeginEditTransaction(classCode, id);

            foreach (JProperty property in @object.Properties())
            {
                objectManipulator.SetPropertyValue(property.Name, property.Value);
            }

            objectManipulator.CommitTransaction();
        }
Ejemplo n.º 2
0
        public void Put(string classCode, int id, [FromBody] JObject obj)
        {
            Class             @class            = this.GetValidatedClass(classCode);
            Object            @object           = this.GetValidatedObject(@class, id);
            ObjectManipulator objectManipulator = new ObjectManipulator(this);

            objectManipulator.BeginEditTransaction(classCode, id);

            foreach (JProperty property in obj.Properties())
            {
                try
                {
                    objectManipulator.SetPropertyValue(property.Name, property.Value);
                }

                catch (System.ArgumentException e)
                {
                    throw new HttpException(400, e.Message);
                }
            }

            objectManipulator.CommitTransaction();
        }