public static BsonDocument AttachCreationMetaData(this BsonDocument doc, IMongoIdentity user) { doc["OwnerId"] = user.GetOwnerId(); doc["CreatedOn"] = DateTime.Now; doc["LastModifiedOn"] = DateTime.Now; doc["LastUpdatedBy"] = user.GetOwnerId(); doc["UTCOffset"] = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).ToString(); return doc; }
public static bool IsOwner(this BsonDocument doc, IMongoIdentity user) { return doc.Contains("OwnerId") && (doc["OwnerId"].AsInt64 == user.GetOwnerId()); }