Example #1
0
        public void Add()
        {
            var model = new GetModelService().GetModel();

            _client.Add(model);
            var result = _client.GetQueryable <TestModel>().FirstOrDefault(p => p.Id == model.Id);

            Assert.NotNull(result);
            Assert.Equal(model.ToJson(), result.ToJson());
        }
Example #2
0
        public Order Get(string id)
        {
            var order = _cache.Get <Order>(id);

            if (order != null)
            {
                return(order);
            }
            order = Convert(_mongoClient.GetQueryable <OrderParentPo>().FirstOrDefault(p => p.Id == id));
            _cache.Add(order.Id, order);
            return(order);
        }
Example #3
0
        public void UpdateSuccess()
        {
            var model = new GetModelService().GetModel();

            _client.Add(model);
            model.Int         = 199;
            model.String      = Guid.NewGuid().ToString();
            model.DateTimeUtc = DateTime.UtcNow;
            _client.Update(model);
            var result = _client.GetQueryable <TestModel>().FirstOrDefault(p => p.Id == model.Id);

            Assert.Equal(model.ToJson(), result.ToJson());
        }
 public Guid?FindIdByName(string name)
 {
     return(_client.GetQueryable <ArticleCategoryEntity>().FirstOrDefault(a => a.Name == name)?.Id);
 }
Example #5
0
 public Guid?FindIdByTitle(string title)
 {
     return(_client.GetQueryable <ArticleEntity>().FirstOrDefault(a => a.Title == title)?.Id);
 }