public void AddRestaurantProduct(int id, Product prod)
        {
            var restProduct = new RestaurantProduct
            {
                Quantity     = 1,
                ProductId    = prod.Id,
                RestaurantId = id
            };

            var restProd = _repo.GetRestaurantProductById(prod.Id);

            if (restProd != null)
            {
                restProd.Quantity++;
            }
            else
            {
                _repo.AddRestaurantProducts(restProduct);
            }
            _repo.SaveChanges();
        }
Beispiel #2
0
 public void AddRestaurantProducts(RestaurantProduct product)
 {
     _db.RestaurantProducts.Add(product);
     _db.SaveChanges();
 }
Beispiel #3
0
 public void AddRestaurantProduct(RestaurantProduct item)
 {
     _db.Add(item);
     _db.SaveChanges();
 }