예제 #1
0
        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);
        }
예제 #3
0
 public ContactsController(IConfiguration config, UserManager <UserModel> userManager, SignInManager <UserModel> signInManager)
 {
     _config        = config;
     db             = new MongoDBDataAccess("MongoContactsDB", _config.GetConnectionString("Default"));
     _userManager   = userManager;
     _signInManager = signInManager;
 }
예제 #4
0
        public static DateTime?GetLastCacheUpdateDate()
        {
            DateTime?lastUpdatedDate = null;
            var      batch           = MongoDBDataAccess.GetASXListedCompaniesBatchRecord(null);

            if (batch != null && batch.Dates != null)
            {
                lastUpdatedDate = batch.Dates.LastUpdatedDate;
            }
            return(lastUpdatedDate);
        }
예제 #5
0
        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));
        }
예제 #6
0
 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;
 }
예제 #7
0
        public static void UpdateCache()
        {
            List <ASXListedCompany> stocks = Fetch();

            MongoDBDataAccess.ProcessASXListedCompaniesBatch(stocks);
        }
예제 #8
0
 public PlayerDataController(MongoDBDataAccess mongo, UserManager <ApplicationUser> userManager)
 {
     _mongo       = mongo;
     _userManager = userManager;
 }
예제 #9
0
 public ContactsController(IConfiguration config)
 {
     this.config = config;
     db          = new MongoDBDataAccess("MongoContactsDB", this.config.GetConnectionString("Default"));
 }