public OrdersController( ILogger <OrdersController> logger, MongoDbService service) { _logger = logger; _service = service; }
public async Task <JsonResult> Get() { var dbService = new MongoDbService("dev-challenge", "Titles", "mongodb://*****:*****@ds043348.mongolab.com:43348/dev-challenge"); var allContent = await dbService.GetContent(); return(Json(allContent)); }
public RssService(MongoDbService mongoDbService) { _mongoDbRss = new MongoDbUtil <Rss>(mongoDbService.Database); _mongoDbRss.Collection.Indexes.CreateOne(new CreateIndexModel <Rss>( Builders <Rss> .IndexKeys.Ascending(x => x.Url))); }
public async Task <JsonResult> Get() { var mongoDbService = new MongoDbService("mongodb://*****:*****@ds149754.mlab.com:49754/chatter", "chatter", "users"); var users = await mongoDbService.GetAllUsers(); return(Json(users)); }
public async Task <JsonResult> Get() { var mongoDbService = new MongoDbService(DatabaseName, "Todos", DatabaseUrl); var allTodos = await mongoDbService.GetAllTodos(); return(Json(allTodos)); }
static void UpdateOne() { var ss = new MongoDbService().Update <BsonDocument>("db1", "colTest1", m => m["CreateTime"].AsString.Contains("2017-12-26"), n => new BsonDocument { { "CreateTime", BsonDateTime.Create(DateTime.Parse(n["CreateTime"].AsString)) } } ); }
public CoverArtService(IBackgroundQueue <CoverArtJob> queue, ILogger <CoverArtService> logger, IMemoryCache memoryCache, MongoDbService dataService) { _queue = queue; _logger = logger; _dataService = dataService; _memoryCache = memoryCache; }
static void GetOne() { var s1 = new MongoDbService().List <BsonDocument>("db1", "colTest2", m => true, m => m, null); foreach (BsonDocument item in s1) { } }
public UsersController(IServiceProvider serviceProvider) { _configuration = serviceProvider.GetService <IConfiguration>(); _memoryCache = serviceProvider.GetService <IMemoryCache>(); _emailService = serviceProvider.GetService <EmailService>(); _mongoDbService = serviceProvider.GetService <MongoDbService>(); _signInManager = serviceProvider.GetService <SignInManager <ApplicationUser> >(); _userManager = serviceProvider.GetService <UserManager <ApplicationUser> >(); }
public NotificationService(MongoDbService mongoDbService, IHttpClientFactory httpClientFactory) { _mongoDbNotification = new MongoDbUtil <Notification>(mongoDbService.Database); _httpClientFactory = httpClientFactory; _mongoDbNotification.Collection.Indexes.CreateOne(new CreateIndexModel <Notification>( Builders <Notification> .IndexKeys.Ascending(x => x.Region))); }
public SourceService(MongoDbService mongoDbService) { _mongoDbSource = new MongoDbUtil <Source>(mongoDbService.Database); _mongoDbSource.Collection.Indexes.CreateOne(new CreateIndexModel <Source>( Builders <Source> .IndexKeys.Ascending(x => x.Type))); _mongoDbSource.Collection.Indexes.CreateOne(new CreateIndexModel <Source>( Builders <Source> .IndexKeys.Ascending(x => x.Type).Ascending(x => x.BoardId))); }
public NotificationService(MongoDbService mongoDbService, IHttpClientFactory httpClientFactory, SourceService sourceService) { _mongoDbNotification = new MongoDbUtil <Notification>(mongoDbService.Database); _httpClientFactory = httpClientFactory; _sourceService = sourceService; _mongoDbNotification.Collection.Indexes.CreateOne(new CreateIndexModel <Notification>( Builders <Notification> .IndexKeys.Ascending(x => x.SourceId) .Ascending(x => x.CrawlingType) .Ascending(x => x.Type))); }
public TrackingService(IConfiguration configuration, MongoDbService mongoDbService, NotificationService notificationService, IHttpClientFactory httpClientFactory) { _riotApiCrawler = new RiotCrawler(mongoDbService.Database, httpClientFactory.CreateClient()).Create(configuration.GetRiotApiCrawlerSettings().RiotApiKey); _notificationService = notificationService; var champions = _riotApiCrawler.GetChampions(Region.KR).Result; if (champions != null) { _champions = champions.ToDictionary(x => x.Key); } }
static void Main(string[] args) { mongoDbService = new MongoDbService("mongodb://localhost:27017", "sirene_app"); //Test3("42","015"); List <Etablissement> data = GetEtablissementsCommune("42", "015"); foreach (Etablissement x in data) { Console.WriteLine($"nomen_long: {x.nomen_long}, libnj: {x.libnj}, natetab: {x.natetab}, libapet: {x.libapet}"); } Console.Read(); }
public void log(string Operator, string Method, string boo, string reason) { var dbService = new MongoDbService(); var id = Guid.NewGuid().ToString(); dbService.Add(new LogEntity { _id = id, Operator = Operator, Method = Method, boo = boo, reason = reason, Time = DateTime.Now }); }
public FeedCrawlingService(MongoDbService mongoDbService, RssService rssService, NotificationService notificationService) { _mongoDbService = mongoDbService; _rssService = rssService; _notificationService = notificationService; _mongoFeedData = new MongoDbUtil <FeedData>(mongoDbService.Database); _mongoFeedData.Collection.Indexes.CreateOne(new CreateIndexModel <FeedData>( Builders <FeedData> .IndexKeys.Ascending(x => x.DateTime))); _mongoFeedData.Collection.Indexes.CreateOne(new CreateIndexModel <FeedData>( Builders <FeedData> .IndexKeys.Ascending(x => x.ItemTitle))); _mongoFeedData.Collection.Indexes.CreateOne(new CreateIndexModel <FeedData>( Builders <FeedData> .IndexKeys.Ascending(x => x.FeedTitle))); }
public WebCrawlingService(MongoDbService mongoDbService, SourceService sourceService, NotificationService notificationService) { _mongoDbService = mongoDbService; _sourceService = sourceService; _notificationService = notificationService; _mongoCrawlingData = new MongoDbUtil <CrawlingData>(mongoDbService.Database); _mongoCrawlingData.Collection.Indexes.CreateOne(new CreateIndexModel <CrawlingData>( Builders <CrawlingData> .IndexKeys.Ascending(x => x.DateTime))); _mongoCrawlingData.Collection.Indexes.CreateOne(new CreateIndexModel <CrawlingData>( Builders <CrawlingData> .IndexKeys.Ascending(x => x.Title))); _mongoCrawlingData.Collection.Indexes.CreateOne(new CreateIndexModel <CrawlingData>( Builders <CrawlingData> .IndexKeys.Ascending(x => x.Type))); _mongoCrawlingData.Collection.Indexes.CreateOne(new CreateIndexModel <CrawlingData>( Builders <CrawlingData> .IndexKeys.Ascending(x => x.Type).Ascending(x => x.BoardId))); }
// GET: MongoDB public ActionResult Index() { //var database = "FinanceDB"; // var collection = "Test1"; // var db = new MongoClient("mongodb://123.207.187.133:27017").GetDatabase(database); // var coll = db.GetCollection<TestMongo>(collection); // var entity = new TestMongo // { // Name = "SkyChen", // Amount = 100, // CreateDateTime = DateTime.Now // }; // coll.InsertOneAsync(entity).ConfigureAwait(false); var ss = new MongoDbService().List <User>(m => true); return(View()); }
/// <summary> /// 获取公告 /// </summary> /// <returns></returns> public ActionResult GetNotice() { DateTime dtNow = DateTime.Now; //判断是否有登录用户 if (Session["AN"] != null) { var msgStatus = DALUtility.MDbS.List <NoticState>("XMShop", "noticstate", x => x.uid.Equals(AN) && x.state < 2, x => new NoticState() { msgid = x.msgid }, null); var result = DALUtility.MDbS.List <NoticEntity>("XMShop", "notic", x => x.starttime <dtNow && x.endtime> dtNow && (x.receiver == null || x.receiver.Contains(Agent_Acc)) && (x.receivermember == null || x.receivermember.Contains(AN)), null, null); return(PagerData(-1, new { msgStatus, result })); } else { MongoDbService dbService = new MongoDbService(); var result = dbService.List <NoticEntity>("XMShop", "notic", x => x.starttime <dtNow && x.endtime> dtNow && x.receiver == null, null, null); return(PagerData(result.Count, result)); } }
public ActionResult <IEnumerable <string> > Get() { MongoDbService mongoService = new MongoDbService(); List <BsonDocument> mongoData = mongoService.GetAllCollection(); //var student1 = new BsonDocument //{ // {"firstname", "Ugo"}, // {"lastname", "Damian"}, // {"subjects", new BsonArray {"English", "Mathematics", "Physics", "Biology"}}, // {"class", "JSS 3"}, // {"age", 23} //}; //var student2 = new BsonDocument //{ // {"firstname", "Julie"}, // {"lastname", "Lerman"}, // {"subjects", new BsonArray {"English", "Mathematics", "Spanish"}}, // {"class", "JSS 3"}, // {"age", 23} //}; //var student3 = new BsonDocument //{ // {"firstname", "Julie"}, // {"lastname", "Lerman"}, // {"subjects", new BsonArray {"English", "Mathematics", "Physics", "Chemistry"}}, // {"class", "JSS 1"}, // {"age", 25} //}; //List<BsonDocument> temps = new List<BsonDocument>(); //temps.Add(student1); //temps.Add(student2); //temps.Add(student3); //mongoService.AddDocuments(temps, "Test"); return(new string[] { "value1", "value2" }); }
public async Task Post([FromBody] UserModel model) { var mongoDbService = new MongoDbService("mongodb://*****:*****@ds149754.mlab.com:49754/chatter", "chatter", "users"); await mongoDbService.InserUserAsync(model); }
public ConfigurationController(MongoDbService service) { _service = service; }
static CustomerRespository() { mongoDbService = mongoDbService ?? new MongoDbService(); }
public SummonerService(IConfiguration configuration, MongoDbService mongoDbService, IHttpClientFactory httpClientFactory) { _riotApiCrawler = new RiotCrawler(mongoDbService.Database, httpClientFactory.CreateClient()).Create(configuration.GetRiotApiCrawlerSettings().RiotApiKey); }
public ProductsController(IServiceProvider serviceProvider) { _mongoDbService = serviceProvider.GetService <MongoDbService>(); }
public SuppliersController(IServiceProvider serviceProvider) { _mongoDbService = serviceProvider.GetService <MongoDbService>(); }
public AnamailController() { _mongoDbService = new MongoDbService("AnimalDatabase", "Animal", "mongodb://localhost:27017"); }
public BooksController() { _bookService = new MongoDbService <Book>("Books"); }
public CategoriesController(IServiceProvider serviceProvider) { _mongoDbService = serviceProvider.GetService <MongoDbService>(); }
static User Get(string id) { var result = new MongoDbService().Get <User>(a => a._id == id); return(result); }