public static UsersToGroup GetByUserIDGroupID(int userID, int groupID, UsersToGroupRelatedData relatedData = UsersToGroupRelatedData.None) { using (IUnitOfWork unitOfWork = new cmiUnitOfWork()) { Repository <UsersToGroup> repository = new Repository <UsersToGroup>(unitOfWork); UsersToGroup userToGroup = repository.Get(x => x.GroupID == groupID && x.UserID == userID, GetIncludeProperties(relatedData)).SingleOrDefault(); return(userToGroup); } }
private static string GetIncludeProperties(UsersToGroupRelatedData includes) { string includeProperties = ""; switch (includes) { case UsersToGroupRelatedData.None: break; case UsersToGroupRelatedData.Events: includeProperties = @"Group.Events"; break; default: break; } return(includeProperties); }