public ActionResult Delete(int id) { Drink deleteDrink = Drink.Find(id); deleteDrink.Delete(); return(RedirectToAction("Index")); }
public ActionResult SubtractAmount(int drink_id) { Drink newDrink = Drink.Find(drink_id); newDrink.MakeDrink(); return(RedirectToAction("Index")); }
public ActionResult Info(int id) { Dictionary <string, object> model = new Dictionary <string, object> { }; Drink thisdrink = Drink.Find(id); List <Inventory> allOfInventory = thisdrink.GetInventory(); List <Ingredient> allOfIngredients = Ingredient.GetIngredients(thisdrink.GetId()); model.Add("thisdrink", thisdrink); model.Add("inventories", allOfInventory); model.Add("ingredients", allOfIngredients); return(View(model)); }
public void Find_FindsDrinkInDatabase_Drink() { //Arrange Drink testDrink = new Drink("Americano"); testDrink.Save(); //Act Drink foundDrink = Drink.Find(testDrink.GetId()); //Assert Assert.AreEqual(testDrink, foundDrink); }
public void Test_FindsDrinkInDatabaseWorks() { //Arrange Drink testDrink = new Drink("Negroni", "Mixed", 1.5, 11.50); testDrink.Save(); //Act Drink result = Drink.Find(testDrink.GetId()); //Assert Assert.Equal(testDrink, result); }
public void Edit_UpdatesDrinkInDatabase_String() { //Arrange string firstName = "Americano"; Drink testDrink = new Drink(firstName); testDrink.Save(); string secondName = "Latte"; //Act testDrink.Edit(secondName); string result = Drink.Find(testDrink.GetId()).GetName(); //Assert Assert.AreEqual(secondName, result); }
public void FindDrink(int id) { FoundDrink = Drink.Find(id); }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Get["/patrons"] = _ => { List <Patron> allPatrons = Patron.GetAll(); return(View["patrons.cshtml", allPatrons]); }; Get["/patrons/add"] = _ => { return(View["patron_add.cshtml"]); }; Post["/patrons/add"] = _ => { Patron newPatron = new Patron(Request.Form["patron-name"], Request.Form["patron-gender"], Request.Form["patron-weight"], Request.Form["patron-height"]); newPatron.Save(); List <Patron> allPatrons = Patron.GetAll(); return(View["patrons.cshtml", allPatrons]); }; Get["/patrons/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); Patron selectedPatron = Patron.Find(parameters.id); List <Drink> allDrinks = Drink.GetAll(); List <Drink> patronDrinks = selectedPatron.GetDrinks(); List <Food> allFood = Food.GetAll(); List <Food> patronFood = selectedPatron.GetFood(); List <Bartender> patronBartender = selectedPatron.GetBartender(); model.Add("patron", selectedPatron); model.Add("allFood", allFood); model.Add("allDrinks", allDrinks); model.Add("patronDrinks", patronDrinks); model.Add("patronBartender", patronBartender); model.Add("patronFood", patronFood); return(View["patron.cshtml", model]); }; Post["/patrons/{id}/add_order"] = parameters => { Patron patron = Patron.Find(Request.Form["patron-id"]); Drink drink = Drink.Find(Request.Form["drink-id"]); Food food = Food.Find(Request.Form["food-id"]); patron.AddDrinkAndFoodToOrdersTable(drink, food); Dictionary <string, object> model = new Dictionary <string, object>(); Patron selectedPatron = Patron.Find(parameters.id); List <Drink> allDrinks = Drink.GetAll(); List <Drink> patronDrinks = selectedPatron.GetDrinks(); List <Bartender> patronBartender = selectedPatron.GetBartender(); List <Food> allFood = Food.GetAll(); List <Food> patronFood = selectedPatron.GetFood(); model.Add("patron", selectedPatron); model.Add("allFood", allFood); model.Add("allDrinks", allDrinks); model.Add("patronDrinks", patronDrinks); model.Add("patronBartender", patronBartender); model.Add("patronFood", patronFood); return(View["patron.cshtml", model]); }; Delete["/patrons/{id}/delete"] = _ => { Patron selectedPatron = Patron.Find(Request.Form["patron-id"]); selectedPatron.Delete(); List <Patron> allPatrons = Patron.GetAll(); return(View["index.cshtml", allPatrons]); }; Get["/bartenders"] = _ => { List <Bartender> allBartenders = Bartender.GetAll(); return(View["bartenders.cshtml", allBartenders]); }; Get["/bartenders/add"] = _ => { return(View["bartenders_add.cshtml"]); }; Post["/bartenders/add"] = _ => { Bartender newBartender = new Bartender(Request.Form["bartender-name"]); newBartender.Save(); List <Bartender> allBartenders = Bartender.GetAll(); return(View["bartenders.cshtml", allBartenders]); }; Get["/bartenders/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>(); Bartender selectedBartender = Bartender.Find(parameters.id); List <Patron> bartenderPatrons = selectedBartender.GetPatrons(); List <Patron> allPatrons = Patron.GetAll(); model.Add("bartender", selectedBartender); model.Add("allPatrons", allPatrons); model.Add("bartenderPatrons", bartenderPatrons); return(View["bartender.cshtml", model]); }; Post["/bartenders/{id}/add_patron"] = parameters => { Bartender bartender = Bartender.Find(Request.Form["bartender-id"]); Patron patron = Patron.Find(Request.Form["patron-id"]); bartender.AddPatronToOrdersTable(patron); Dictionary <string, object> model = new Dictionary <string, object>(); Bartender selectedBartender = Bartender.Find(parameters.id); List <Patron> bartenderPatrons = selectedBartender.GetPatrons(); List <Patron> allPatrons = Patron.GetAll(); model.Add("bartender", selectedBartender); model.Add("allPatrons", allPatrons); model.Add("bartenderPatrons", bartenderPatrons); return(View["bartender.cshtml", model]); }; Get["/bartenders/menu"] = _ => { Dictionary <string, object> model = new Dictionary <string, object>(); List <Drink> allDrinks = Drink.GetAll(); List <Food> allFood = Food.GetAll(); model.Add("allFood", allFood); model.Add("allDrinks", allDrinks); return(View["bar_menu.cshtml", model]); }; Get["/drinks"] = _ => { Dictionary <string, object> model = new Dictionary <string, object>(); List <Drink> allDrinks = Drink.GetAll(); List <Food> allFood = Food.GetAll(); model.Add("allFood", allFood); model.Add("allDrinks", allDrinks); return(View["bar_menu.cshtml", model]); }; Get["/drinks/add"] = _ => { return(View["drinks_add.cshtml"]); }; Post["/drinks/add"] = _ => { Drink newDrink = new Drink(Request.Form["drink-name"], Request.Form["drink-type"], Request.Form["drink-abv"], Request.Form["drink-cost"], Request.Form["drink-instances"]); newDrink.Save(); Dictionary <string, object> model = new Dictionary <string, object>(); List <Drink> allDrinks = Drink.GetAll(); List <Food> allFood = Food.GetAll(); model.Add("allFood", allFood); model.Add("allDrinks", allDrinks); return(View["bar_menu.cshtml", model]); }; Get["/food"] = _ => { Dictionary <string, object> model = new Dictionary <string, object>(); List <Drink> allDrinks = Drink.GetAll(); List <Food> allFood = Food.GetAll(); model.Add("allFood", allFood); model.Add("allDrinks", allDrinks); return(View["bar_menu.cshtml", model]); }; Get["/food/add"] = _ => { return(View["food_add.cshtml"]); }; Post["/food/add"] = _ => { Food newFood = new Food(Request.Form["food-type"], Request.Form["food-description"], Request.Form["food-cost"], Request.Form["food-bac-removal"]); newFood.Save(); Dictionary <string, object> model = new Dictionary <string, object>(); List <Drink> allDrinks = Drink.GetAll(); List <Food> allFood = Food.GetAll(); model.Add("allFood", allFood); model.Add("allDrinks", allDrinks); return(View["bar_menu.cshtml", model]); }; }
public ActionResult Details(int id) { Drink drinkDetails = Drink.Find(id); return(View(drinkDetails)); }
public ActionResult DeleteOneDrink(int drinkId) { Drink.Find(drinkId).Delete(); return(RedirectToAction("Index")); }