public static CourtWebsite GetCourtWebSite(ObjectId id) { CourtWebsite cw = new CourtWebsite(); Task.Run(async () => { var filter = Builders<CourtWebsite>.Filter.Eq("Id", id); cw = await GetCourtWebSiteCollection().Find(filter).FirstAsync(); }).Wait(); return cw; }
public static void InsertNewCourt(string courtName, string url, string courtKey, string xPath) { var courtWebsite = new CourtWebsite { Id = ObjectId.GenerateNewId(), Url = url, CourtName = courtName, OldPageHtml = "Never Diffed", NewPageHtml = "Never Diffed", DiffedHtml = "Never Diffed", LastChangedDateTime = DateTime.MinValue, LastRunDateTime = DateTime.MinValue, SelectionXPathString = xPath, Checked = false }; Task.Run(async () => { await GetCourtWebSiteCollection().InsertOneAsync(courtWebsite); }).Wait(); }
/// <summary> /// overload to handle a courtwebsite object /// </summary> /// <param name="courtWebsite"></param> public static void InsertNewCourt(CourtWebsite courtWebsite) { InsertNewCourt(courtWebsite.CourtName, courtWebsite.Url, courtWebsite.CourtKey, courtWebsite.SelectionXPathString); }