public bool AddCart(AddCartCommand newCart)
        {
            using (var db = new SqlConnection(_connectionString))
            {
                var sql = @"INSERT INTO [dbo].[Cart]
                                       ([Total])
                                 VALUES
                                       (@total)";

                return(db.Execute(sql, newCart) == 1);
            }
        }
        public void Create(AddCartCommand newCart)
        {
            var repo = new CartRepository();

            repo.AddCart(newCart);
        }
Пример #3
0
 public Cart(AddCartCommand command) : this(IdGenerator.NewId)
 {
     ProductId = command.ProductId;
     Quantity  = command.Quantity;
     UserId    = command.UserId;
 }