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); } }
public bool Write(int id, TEntity entity) { var propertiesName = typeof(TEntity).GetPropertiesName().ToLowerAndSplitWithUnderscore(); var entityStruct = entity.ToXmlRpcStruct().NotNull(propertiesName); return(connection.Write(model, new int[1] { id }, entityStruct)); }