Пример #1
0
 public void SaveCart(Cart cart)
 {
     if (cart.MemberId > 0)
     {
         var repository = new MongoRepository<Cart>();
         if (string.IsNullOrEmpty(cart.Id))
         {
             repository.Add(cart);
         }
         else
         {
             repository.Update(cart);
         }
     }
 }
Пример #2
0
 public Cart GetCart(int memberId)
 {
     var repository = new MongoRepository<Cart>();
     var cart = repository.FirstOrDefault(c => c.MemberId == memberId);
     return cart ?? new Cart { MemberId = memberId };
 }