コード例 #1
0
        public void Post(string classCode, [FromBody] JObject obj)
        {
            Class             @class            = this.GetValidatedClass(classCode);
            ObjectManipulator objectManipulator = new ObjectManipulator(this);

            objectManipulator.BeginCreateTransaction(classCode);

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

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

            int    objectId = objectManipulator.CommitTransaction();
            Object @object  = this.Storage.GetRepository <IObjectRepository>().WithKey(objectId);

            Event <IObjectCreatedEventHandler, IRequestHandler, Object> .Broadcast(this, @object);
        }
コード例 #2
0
        public void Post(string classCode, [FromBody] JObject @object)
        {
            ObjectManipulator objectManipulator = new ObjectManipulator(this);

            objectManipulator.BeginCreateTransaction(classCode);

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

            objectManipulator.CommitTransaction();
        }
コード例 #3
0
        public void Post(string classCode, [FromBody] JObject obj)
        {
            Class             @class            = this.GetValidatedClass(classCode);
            ObjectManipulator objectManipulator = new ObjectManipulator(this);

            objectManipulator.BeginCreateTransaction(classCode);

            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();
        }