Ejemplo n.º 1
0
        public void Save()
        {
            var values = new XmlRpcStruct();

            if (_id >= 0)
            {
                foreach (var field in _fieldsResult.Where(f => (bool)f.Changed))
                {
                    values[field.FieldName] = field.Value;
                }

                _rpcConnection.Write(_model, new int[1] {
                    _id
                }, values);
            }
            else
            {
                foreach (var field in _fieldsResult)
                {
                    values[field.FieldName] = field.Value;
                }

                _id = _rpcConnection.Create(_model, values);
            }
        }
Ejemplo n.º 2
0
        public int Create(TEntity entity)
        {
            var propertiesName = typeof(TEntity).GetPropertiesName().ToLowerAndSplitWithUnderscore();
            var entityStruct   = entity.ToXmlRpcStruct().NotNull(propertiesName);

            return(connection.Create(model, entityStruct));
        }