public void AddCart(Cart cart) { //prevent include custom TotalCost values cart.TotalCost = 0; db.Carts.Add(cart); SaveChanges(); }
public IHttpActionResult PostCart(Cart cart) { if (!ModelState.IsValid) { return BadRequest(ModelState); } repo.AddCart(cart); return Ok(cart); }