public IEnumerable <Ingridient> Get()
 {
     using (BurgerContext context = new BurgerContext())
     {
         return(context.Ingridients.ToList());
     }
 }
 public IEnumerable <Bong> Get()
 {
     using (BurgerContext context = new BurgerContext())
     {
         return(context.Bongs.ToList());
     }
 }
Exemplo n.º 3
0
 public IEnumerable <Product> Get()
 {
     using (BurgerContext context = new BurgerContext())
     {
         return(context.Products.ToList());
     }
 }
Exemplo n.º 4
0
 public IActionResult Post([FromBody] Bong newBong)
 {
     using (BurgerContext context = new BurgerContext())
     {
         context.Bongs.Add(newBong);
         context.SaveChanges();
     }
     return(Created("/burger", newBong));
 }
Exemplo n.º 5
0
 public IActionResult Post([FromBody] Product newProduct)
 {
     using (BurgerContext context = new BurgerContext())
     {
         context.Products.Add(newProduct);
         context.SaveChanges();
     }
     return(Created("/burger", newProduct));
 }
Exemplo n.º 6
0
 public IActionResult Post([FromBody] Ingredient newIngredient)
 {
     using (BurgerContext context = new BurgerContext())
     {
         context.Ingredients.Add(newIngredient);
         context.SaveChanges();
     }
     return(Created("/burger", newIngredient));
 }
Exemplo n.º 7
0
 public IActionResult Delete(int id)
 {
     using (BurgerContext context = new BurgerContext())
     {
         Product toRemove = context.Products.First(p => p.Id == id);
         context.Products.Remove(toRemove);
         context.SaveChanges();
     }
     return(Ok());
 }
Exemplo n.º 8
0
 public IActionResult Put(int id, [FromBody] Product p)
 {
     using (BurgerContext context = new BurgerContext())
     {
         Product toUpdate = context.Products.First(p => p.Id == id);
         toUpdate.Price  = p.Price;
         toUpdate.Burger = p.Burger;
         context.SaveChanges();
     }
     return(Ok());
 }
Exemplo n.º 9
0
 public BurgersController(BurgerContext context)
 {
     _context = context;
 }