/// <summary> /// Create a new CollectionUser object /// </summary> /// <param name="collection">The collection</param> /// <param name="user">The user</param> /// <param name="access">Allow/deny access</param> /// <returns>The new CollectionUser object</returns> public static CollectionUser CreateNew(Collection collection, User user, bool access) { CollectionUser cu = new CollectionUser(); cu.CollectionId = collection.Id; cu.UserId = user.Id; cu.Access = access; cu.isNew = true; return cu; }
/// <summary> /// Create a new instance of CollectionUser using data from database /// </summary> /// <param name="data">The data</param> /// <returns>A CollectionUser object from data</returns> private static CollectionUser FromData(Dictionary<string, object> data) { CollectionUser cu = new CollectionUser(); cu.CollectionId = Convert.ToInt32(data["cid"]); cu.UserId = Convert.ToInt32(data["uid"]); cu.Access = Convert.ToInt32(data["access"]) == 1; return cu; }
public static CollectionUserJson[] ToJsonArray(CollectionUser[] cus) { List<CollectionUserJson> objs = new List<CollectionUserJson>(); foreach (CollectionUser cu in cus) { objs.Add(cu.ToJson()); } return objs.ToArray(); }