Ejemplo n.º 1
0
        public void GetProductenPerWinkelTest()
        {
            Winkel snackbar = new Winkel("snackbar");

            Repo.AddWinkel(snackbar);
            Product kroket = new Product("kroket", 180, snackbar);

            Repo.AddProduct(kroket);
            Assert.IsFalse(Repo.GetProducten(Repo.GetWinkel("appie")).Contains <Product>(kroket));
            Assert.IsTrue(Repo.GetProducten(Repo.GetWinkel("snackbar")).Contains <Product>(kroket));
        }
Ejemplo n.º 2
0
        public ActionResult GetProductenPerWinkel(string winkelnaam)
        {
            List <Product> producten = new List <Product>();
            Winkel         winkel;

            try
            {
                winkel    = Repo.GetWinkel(winkelnaam);
                producten = Repo.GetProducten(winkel).ToList();
                return(Json(producten));
            }

            catch (Exception e)
            {
                if (e is InvalidOperationException)
                {
                    return(NotFound());
                }
                else
                {
                    return(StatusCode(StatusCodes.Status500InternalServerError));
                }
            }
        }