public async Task <Cart> Update(Cart model)
        {
            var carts = await _dao.Get(new CartGetOptions { ProductId = model.ProductId, Ordered = model.OrderId.HasValue });

            var oldCart    = carts.FirstOrDefault();
            int countDelta = 0;

            if (oldCart != null)
            {
                countDelta = oldCart.Count - model.Count;
                if (model.Count == 0)
                {
                    await _dao.Delete(new List <int> {
                        model.Id
                    });
                }
                else
                {
                    await _dao.Update(model);
                }
            }
            else
            {
                countDelta -= model.Count;
                await _dao.Create(model);
            }
            if (!model.OrderId.HasValue)
            {
                var products = await _productService.Get(new ProductGetOptions { Id = model.ProductId });

                if (products.Count() > 0)
                {
                    var product = products.FirstOrDefault();
                    product.Count += countDelta;
                    await _productService.Update(product);
                }
            }
            return(model);
        }
 public void Delete(Cart genre)
 {
     _cartDao.Delete(genre);
 }