public IHttpActionResult Postcart(Guid id)
        {
            AspNetUser user = db.AspNetUsers.Where(a => a.UserName == User.Identity.Name).First();
            cart cart = new cart() { AspNetUser = user, product = db.products.Where(p => p.id == id).First(), product_id = id, user_id = user.Id, quantity = 0, id = Guid.NewGuid() };

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.carts.Add(cart);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (cartExists(cart.id))
                {
                    return Conflict();
                }
                else
                {
                    throw;
                }
            }

            return CreatedAtRoute("DefaultApi", new { id = cart.id }, cart);
        }
        public IHttpActionResult Putcart(Guid id, cart cart)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != cart.id)
            {
                return BadRequest();
            }

            db.Entry(cart).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!cartExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }