/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public static void AddMemberToList(Couchbase.Lite.Document list, Couchbase.Lite.Document user) { IDictionary<string, object> newProperties = new Dictionary<string, object>(); newProperties.PutAll(list.Properties); IList<string> members = (IList<string>)newProperties.Get("members"); if (members == null) { members = new AList<string>(); } members.AddItem(user.Id); newProperties.Put("members", members); try { list.PutProperties(newProperties); } catch (CouchbaseLiteException e) { Log.E(Application.Tag, "Cannot add member to the list", e); } }
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public static void UpdateCheckedStatus(Couchbase.Lite.Document task, bool @checked ) { IDictionary<string, object> properties = new Dictionary<string, object>(); properties.PutAll(task.GetProperties()); properties.Put("checked", @checked); task.PutProperties(properties); }
/// <exception cref="Couchbase.Lite.CouchbaseLiteException"></exception> public static void RemoveMemberFromList(Couchbase.Lite.Document list, Couchbase.Lite.Document user) { IDictionary<string, object> newProperties = new Dictionary<string, object>(); newProperties.PutAll(list.Properties); IList<string> members = (IList<string>)newProperties.Get("members"); if (members != null) { members.Remove(user.Id); } newProperties.Put("members", members); list.PutProperties(newProperties); }