static void Main(string[] args) { db = new MongoDBDataAccess("MongoContactsDB", GetConnectionString()); ContactModel nc = new ContactModel { FirstName = "nFname1", LastName = "nLname1" }; nc.EmailAddresses.Add(new EmailAddressModel { EmailAddress = "*****@*****.**" }); nc.EmailAddresses.Add(new EmailAddressModel { EmailAddress = "*****@*****.**" }); nc.PhoneNumbers.Add(new PhoneNumberModel { PhoneNumber = "555-123-1111" }); nc.PhoneNumbers.Add(new PhoneNumberModel { PhoneNumber = "555-123-2222" }); //CreateContact(nc); //GetAllContacts(); //GetContactById("9c8e2f9f-15c1-411e-9246-a99908dcb5b5"); //UpdateContactsFirstName("nFname1z", "9c8e2f9f-15c1-411e-9246-a99908dcb5b5"); //RemovePhoneNumber("555-123-2222", "9c8e2f9f-15c1-411e-9246-a99908dcb5b5"); //RemoveContact("9c8e2f9f-15c1-411e-9246-a99908dcb5b5"); Console.WriteLine("done mongo"); Console.ReadLine(); }
public void ShouldConnectToMongoDB() { MongoDBDataAccess dbHandle = new MongoDBDataAccess(mongoConnectionString, @"C:\WebHost\mongodb.pfx", "123456"); var handle = dbHandle.GetDatabaseHandle(); Assert.IsNotNull(handle); }
public ContactsController(IConfiguration config, UserManager <UserModel> userManager, SignInManager <UserModel> signInManager) { _config = config; db = new MongoDBDataAccess("MongoContactsDB", _config.GetConnectionString("Default")); _userManager = userManager; _signInManager = signInManager; }
public static DateTime?GetLastCacheUpdateDate() { DateTime?lastUpdatedDate = null; var batch = MongoDBDataAccess.GetASXListedCompaniesBatchRecord(null); if (batch != null && batch.Dates != null) { lastUpdatedDate = batch.Dates.LastUpdatedDate; } return(lastUpdatedDate); }
public IActionResult FindASXStocks(string match, int count) { List <ASXListedCompany> stocks = MongoDBDataAccess.FindCompaniesByCode(match, count); if (stocks == null || stocks.Count < count || count == 0) { (stocks ?? new List <ASXListedCompany>()).AddRange(MongoDBDataAccess.FindCompaniesByDescriptionLessCode(match, count == 0? count : count - stocks.Count) ?? new List <ASXListedCompany>()); } return(new JsonResult(stocks)); }
public AccountController( UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IEmailSender emailSender, ISmsSender smsSender, ILoggerFactory loggerFactory, MongoDBDataAccess mongo) { _userManager = userManager; _signInManager = signInManager; _emailSender = emailSender; _smsSender = smsSender; _logger = loggerFactory.CreateLogger <AccountController>(); _mongo = mongo; }
public static void UpdateCache() { List <ASXListedCompany> stocks = Fetch(); MongoDBDataAccess.ProcessASXListedCompaniesBatch(stocks); }
public PlayerDataController(MongoDBDataAccess mongo, UserManager <ApplicationUser> userManager) { _mongo = mongo; _userManager = userManager; }
public ContactsController(IConfiguration config) { this.config = config; db = new MongoDBDataAccess("MongoContactsDB", this.config.GetConnectionString("Default")); }