Пример #1
0
 public void AddCart(Cart cart)
 {
     //prevent include custom TotalCost values
     cart.TotalCost = 0;
     db.Carts.Add(cart);
     SaveChanges();
 }
Пример #2
0
        public IHttpActionResult PostCart(Cart cart)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            repo.AddCart(cart);

            return Ok(cart);
        }