예제 #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 };
 }