// Update is called once per frame void Update() { if (sausageCooking) { if (sausageCookingScript.GetBeingCooked()) { timeBeingCooked += Time.deltaTime; if (timeBeingCooked >= secondsPerCookTick) { timeBeingCooked = 0.0f; ++cookTick; if (cookTick == cookTicksToBurn - 1) { sausageCookingScript.SetCookState(Ingredient.COOKED_SAUSAGE); } else if (cookTick == cookTicksToBurn) { sausageCookingScript.SetCookState(Ingredient.BURNT_SAUSAGE); } } } else { sausageCooking = null; sausageCookingScript = null; timeBeingCooked = 0.0f; cookTick = 0; } } }
public void T03_Remove() { Sausage sausageA, sausageB, sausageC, sausageD; SausageList list = new SausageList(); sausageA = new Sausage(SausageType.EierWurst, DateTime.Now.AddDays(1), 0.2); sausageB = new Sausage(SausageType.ExtraWurst, DateTime.Now.AddDays(12), 0.5); sausageC = new Sausage(SausageType.LeberKaese, DateTime.Now.AddDays(3), 0.3); sausageD = new Sausage(SausageType.EierWurst, DateTime.Now.AddDays(10), 0.4); list.Add(sausageA); list.Add(sausageB); list.Add(sausageC); list.Add(sausageD); Assert.AreEqual(4, list.Count, "Count zählt nicht richtig"); Assert.AreEqual(1.4, list.WeightOfAllSausages, 0.000000001, "Gesamtgewicht aller Würste funktioniert nicht richtig"); int position = list.GetPos(sausageB); Assert.AreEqual(0, position); list.RemoveSausageOnPosition(position); Assert.AreEqual(0.9, list.WeightOfAllSausages, 0.0001, "Um 0,5 kg leichter"); Assert.AreEqual(3, list.Count); position = list.GetPos(sausageB); Assert.AreEqual(-1, position, "SausageB ist nicht mehr in der Liste"); Sausage expected = list[SausageType.ExtraWurst]; Assert.IsNull(expected, "Keine Extrawurst mehr"); }
private void Awake() { sausageCooking = null; sausageCookingScript = null; timeBeingCooked = 0.0f; cookTick = 0; }
public void T02_SausageListAdd() { Sausage sausageA, sausageB, sausageC, sausageD; SausageList list = new SausageList(); sausageA = new Sausage(SausageType.EierWurst, DateTime.Now.AddDays(1), 0.2); sausageB = new Sausage(SausageType.ExtraWurst, DateTime.Now.AddDays(12), 0.5); sausageC = new Sausage(SausageType.LeberKaese, DateTime.Now.AddDays(3), 0.3); sausageD = new Sausage(SausageType.EierWurst, DateTime.Now.AddDays(10), 0.4); list.Add(sausageA); Assert.AreEqual(1, list.Count, "Count zählt nicht richtig"); Assert.AreEqual(sausageA.Weight, list.WeightOfAllSausages, 0.000000001, "Gesamtgweicht stimmt nicht"); list.Add(sausageB); Assert.AreEqual(2, list.Count, "Count zählt nicht richtig"); Assert.AreEqual(0.7, list.WeightOfAllSausages, 0.000000001, "Gesamtgewicht Addition funktioniert nicht richtig"); list.Add(sausageC); Assert.AreEqual(3, list.Count, "Count zählt nicht richtig"); Assert.AreEqual(1, list.WeightOfAllSausages, 0.000000001, "Gesamtgewicht Addition funktioniert nicht richtig"); Assert.AreEqual(SausageType.ExtraWurst, list[0].SausageType, "Position wurde falsch übergeben"); Assert.AreEqual(SausageType.LeberKaese, list[1].SausageType, "Position wurde falsch übergeben"); Assert.AreEqual(SausageType.EierWurst, list[2].SausageType, "Position wurde falsch übergeben"); list.Add(sausageD); Assert.AreEqual(4, list.Count, "Count zählt nicht richtig"); Assert.AreEqual(1.4, list.WeightOfAllSausages, 0.000000001, "Gesamtgewicht aller Würste funktioniert nicht richtig"); Assert.AreEqual(0.4, list[3].Weight, 0.000000001, "Position zweite Eierwurst wurde falsch übergeben"); }
public void Test_Sausage() { var sut = new Sausage(); Assert.True(sut.Name.Equals("Sausage")); Assert.True(sut.Price.Equals(3.00m)); }
public void T04_CutFromSausage() { Sausage sausageA, sausageB, sausageC, sausageD; SausageList list = new SausageList(); sausageA = new Sausage(SausageType.EierWurst, DateTime.Now.AddDays(1), 0.2); sausageB = new Sausage(SausageType.ExtraWurst, DateTime.Now.AddDays(12), 0.5); sausageC = new Sausage(SausageType.LeberKaese, DateTime.Now.AddDays(3), 0.3); sausageD = new Sausage(SausageType.EierWurst, DateTime.Now.AddDays(10), 0.5); Sausage sausageExpected; list.Add(sausageA); list.Add(sausageB); list.Add(sausageC); list.Add(sausageD); Sausage givenSausage = list.CutFromSausage(SausageType.EierWurst, 0.1); Assert.AreEqual(4, list.Count, "Einfacher Cut falsch berechnet(0.1 von sausageA übrig"); sausageExpected = list[SausageType.EierWurst]; Assert.AreSame(sausageA, sausageExpected, "Eierwurst A ist noch nicht verbraucht"); Assert.AreEqual(1.4, list.WeightOfAllSausages, 0.000000001, "10 Deka fehlen jetzt"); givenSausage = list.CutFromSausage(SausageType.EierWurst, 0.3); Assert.AreEqual(3, list.Count, "Eine Eierwurst ist nun verbraucht"); Assert.AreEqual(1.1, list.WeightOfAllSausages, 0.0001, "zweite Wurst angeschnitten"); givenSausage = list.CutFromSausage(SausageType.EierWurst, 0.8); Assert.AreEqual(2, list.Count, "Zweite Eierwurst ist nun auch verbraucht"); Assert.AreEqual(0.8, list.WeightOfAllSausages, 0.0001, "restliche zwei Würste"); Assert.AreEqual(0.3, givenSausage.Weight, 0.001); givenSausage = list.CutFromSausage(SausageType.EierWurst, 0.3); Assert.IsNull(givenSausage, "keine Eierwurst mehr vorhanden"); }
/** * Turn a list of lattice node clusters into a Sausage object. * * @param clusters the list of node clusters in topologically correct order * @return the Sausage corresponding to the cluster list */ protected Sausage sausageFromClusters(List <Cluster> clusters) { Sausage sausage = new Sausage(clusters.Count); int index = 0; foreach (Cluster cluster in clusters) { HashSet <String> seenWords = new HashSet <String>(); foreach (Node node in cluster) { Word word = node.getWord(); if (seenWords.Contains(word.getSpelling())) { continue; } seenWords.Add(word.getSpelling()); WordResult swr = new WordResult( node, wordSubClusterProbability( cluster, word.getSpelling())); sausage.addWordHypothesis(index, swr); } index++; } sausage.fillInBlanks(); return(sausage); }
public async Task <Sausage> CreateSausage(Sausage sausage) { await _sausageDbContext.Sausages.AddAsync(sausage); await _sausageDbContext.SaveChangesAsync(); return(sausage); }
public void Test_Sausage() { //arrange var sut = new Sausage(); //act //assert Assert.True(sut.name.Equals("Sausage")); }
public static void DecoratorCommand() { Pizza mypizza = new ThickCrust(); mypizza = new Pepperoni(mypizza); mypizza = new Sausage(mypizza); Console.WriteLine("This is the decorator pattern. It allows behaviors to be added to an existing object dynamically during runtime."); Console.WriteLine("Here we use a decorator pattern to make a pizza, and add things to it, and then to tell us it's cost."); Console.WriteLine($"Pizza costs: {mypizza.cost()}"); Console.ReadLine(); }
public void SelectSausage(Sausage sausage) { try { SelectedSausage = sausage; } catch { Debug.WriteLine("Error whilte selecting sausage"); } }
/// <summary> /// Map DBTopping => Topping /// Uses enum to determine which topping class to return. /// </summary> /// <param name="entity"></param> /// <returns></returns> public ATopping Map(DBTopping entity) { ATopping topping = null; switch (entity.TOPPING) { case TOPPINGS.BACON: topping = new Bacon(); break; case TOPPINGS.CHICKEN: topping = new Chicken(); break; case TOPPINGS.EXTRACHEESE: topping = new ExtraCheese(); break; case TOPPINGS.GREENPEPPER: topping = new GreenPepper(); break; case TOPPINGS.HAM: topping = new Ham(); break; case TOPPINGS.NOCHEESE: topping = new NoCheese(); break; case TOPPINGS.PINEAPPLE: topping = new Pineapple(); break; case TOPPINGS.REDPEPPER: topping = new RedPepper(); break; case TOPPINGS.SAUSAGE: topping = new Sausage(); break; default: throw new ArgumentException("Topping not recognized. Topping could not be mapped properly"); } topping.ID = entity.ID; return(topping); }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; switch (info.ButtonID) { case 0: { from.SendMessage("You Have Created Meat."); Item o_item = null; switch (Utility.Random(3)) { case 0: o_item = new Ham(); break; case 1: o_item = new CookedBird(); break; case 2: o_item = new Sausage(); break; } from.AddToBackpack(o_item); from.CloseGump(typeof(CreateFoodGump)); break; } case 1: { from.SendMessage("You Have Created Fruits & Vegies."); Item o_item = null; switch (Utility.Random(3)) { case 0: o_item = new Apple(); break; case 1: o_item = new Carrot(); break; case 2: o_item = new Grapes(); break; } from.AddToBackpack(o_item); from.CloseGump(typeof(CreateFoodGump)); break; } } }
public void Cut(Sausage sausage) { audioPlayer.PlayOneShot(slice); List <Sausage> saus = new List <Sausage>(); for (int i = sausage.id; i < sausages.Count; i++) { saus.Add(sausages[i].GetComponent <Sausage>()); if (!sausages[i].GetComponent <Sausage>().HasShield()) { sausages[i] = null; } } UpdateList(); StartCoroutine(Deatach(saus)); }
public void T01_Sausage_Plus() { Sausage a = new Sausage(SausageType.LeberKaese, DateTime.Now.AddDays(1), 0.1); Sausage b = new Sausage(SausageType.EierWurst, DateTime.Now.AddDays(2), 0.1); Sausage c = new Sausage(SausageType.EierWurst, DateTime.Now.AddDays(2), 0.3); Sausage d = new Sausage(SausageType.ExtraWurst, DateTime.Now.AddDays(2), 0.4); Sausage result = a + b; Assert.AreEqual(DateTime.Now.AddDays(1).ToShortTimeString(), result.DateOfExpiry.ToShortTimeString(), "Ablaufdatum stimmt nicht"); Assert.AreEqual(SausageType.LeberKaese, result.SausageType); Assert.AreEqual(0.2, result.Weight, 0.000000001); result = b + c; Assert.AreEqual(SausageType.EierWurst, result.SausageType); Assert.AreEqual(0.4, result.Weight, 0.000000001); result = c + d; Assert.AreEqual(SausageType.Faschiertes, result.SausageType); Assert.AreEqual(0.7, result.Weight, 0.000000001); }
public void MakeBreakfast() { // делаем кофе BoiledWater boiledWater = new BoiledWater(); // набираем воду CoffeeBeans coffeeBeans = new CoffeeBeans(); // берем зерна coffee = new Coffee(coffeeBeans, boiledWater); // варим кофе // делаем бутерброд Bread bread = new Bread(); // покупаем хлеб Sausage sausage = new Sausage(); // покупаем колбасу PieceBread pieceBread = Knife.Cut(bread); // режем хлеб SausageField sausageField = Knife.Cut(sausage); // режем колбасу sandwich = new Sandwich(pieceBread, sausageField); // складываем все вместе Console.WriteLine("Завтрак готов"); }
public override IPizza GetPizza(ToppingType tType) { IPizza currentPizza; switch (tType) { case ToppingType.Cheese: IPizza cheeseZa = new CheesePizza(); currentPizza = cheeseZa; return(currentPizza); case ToppingType.Pepperoni: IPizza pepZa = new CheesePizza(); pepZa = new Pepperoni(pepZa); currentPizza = pepZa; return(currentPizza); case ToppingType.Sausage: IPizza sausageZa = new CheesePizza(); sausageZa = new Sausage(sausageZa); currentPizza = sausageZa; return(currentPizza); case ToppingType.Supreme: IPizza supremeZa = new CheesePizza(); supremeZa = new Supreme(supremeZa); currentPizza = supremeZa; return(currentPizza); case ToppingType.BbqChicken: IPizza bbqZa = new CheesePizza(); bbqZa = new BBQChicken(bbqZa); currentPizza = bbqZa; return(currentPizza); case ToppingType.Margherita: IPizza margZa = new CheesePizza(); margZa = new Margherita(margZa); currentPizza = margZa; return(currentPizza); } return(null); }
public override void newResult(Result result) { String @ref = result.getReferenceText(); if (result.isFinal() && @ref != null) { Lattice lattice = new Lattice(result); LatticeOptimizer optimizer = new LatticeOptimizer(lattice); optimizer.optimize(); lattice.computeNodePosteriors(languageModelWeight); SausageMaker sausageMaker = new SausageMaker(lattice); Sausage sausage = sausageMaker.makeSausage(); sausage.removeFillers(); getAligner().alignSausage(@ref, sausage); showFullPath(result); showDetails(result.ToString()); } }
private void Restock_Callback() { if (TotalItems < ItemsMax) { for (int i = TotalItems; i < ItemsMax; i++) { Item item = null; switch (Utility.RandomMinMax(1, 11)) { default: case 1: item = new Grapes(); break; case 2: item = new Ham(); break; case 3: item = new CheeseWedge(); break; case 4: item = new Muffins(); break; case 5: item = new FishSteak(); break; case 6: item = new Ribs(); break; case 7: item = new CookedBird(); break; case 8: item = new Sausage(); break; case 9: item = new Apple(); break; case 10: item = new Peach(); break; case 11: item = new Bandage(); break; } if (item != null) { DropItem(item); } } } }
static void Main(string[] args) { Console.WriteLine("Welcome to Matt's Pizza"); Console.WriteLine("Your current order contains:"); Console.WriteLine(""); Pizza pizza1 = new MajorMeats(); Console.WriteLine(pizza1.getDescription()+ " $" + pizza1.cost()); Console.WriteLine("----"); Pizza pizza2 = new MattsFavorite(); pizza2 = new GreenPeppers(pizza2); pizza2 = new ItalianSausage(pizza2); pizza2 = new Sausage(pizza2); pizza2 = new ItalianSausage(pizza2); pizza2 = new ArtichokeHearts(pizza2); Console.WriteLine(pizza2.getDescription() + " $" + pizza2.cost()); Console.WriteLine("----"); Pizza pizza3 = new TheWorks(); pizza3 = new PortabelloMushrooms(pizza3); pizza3 = new KalmataOlives(pizza3); pizza3 = new BhutJolokiaPeppers(pizza3); pizza3 = new JalapenoPeppers(pizza3); pizza3 = new Pepperoni(pizza3); Console.WriteLine(pizza3.getDescription() + " $" + pizza3.cost()); Console.WriteLine("----"); Pizza pizza4 = new GardenVeggie(); pizza4 = new ParmigianoReggianoCheese(pizza4); pizza4 = new PortabelloMushrooms(pizza4); pizza4 = new Onions(pizza4); pizza4 = new Bacon(pizza4); Console.WriteLine(pizza4.getDescription() + " $" + pizza4.cost()); Console.WriteLine("----"); Console.WriteLine("Press the m key to see the menu or any other key to exit."); string menuChoice = Console.ReadKey().Key.ToString(); if (menuChoice=="M"){ gimmeMenu(); } }
private static void Main(string[] args) { List <Sausage> sausages = new List <Sausage>(); //Todo: Würste erstellen und zur List<Sausage> hinzufügen Sausage sausageOne = new Sausage(SausageType.EierWurst, new DateTime(2021, 03, 02), 0.25); Sausage sausageTwo = new Sausage(SausageType.ExtraWurst, new DateTime(2020, 12, 24), 0.50); Sausage sausageThree = new Sausage(SausageType.LeberKaese, new DateTime(2020, 11, 02), 0.10); Sausage sausageFour = new Sausage(SausageType.EierWurst, new DateTime(2022, 08, 03), 0.30); sausages.Add(sausageOne); sausages.Add(sausageTwo); sausages.Add(sausageThree); sausages.Add(sausageFour); //IComparable bei Sausage implementieren --> dann kann untenstehende Zeile auskommentiert werden sausages.Sort(); //Todo: Würste ausgeben um Sortierung zu prüfen foreach (Sausage sausage in sausages) { Console.WriteLine($"Typ: {sausage.SausageType.ToString(),-12} Gewicht: {sausage.Weight,5:f} "); } }
public override void BuildBurger() { Random rnd = new Random(); int randomMaxMeats = rnd.Next(_maxItems[0]); for (int i = 0; i < randomMaxMeats; i++) { int randMeat = rnd.Next(3); switch (randMeat) { case 0: Beef b = new Beef { Weight = rnd.NextDouble() * rnd.Next(5), Name = "говядина" }; Burger.AddMeat(b); Console.WriteLine("Добавили говядины"); MoneyCounter.LogBuyes(b); break; case 1: Ham h = new Ham { Weight = rnd.NextDouble() * rnd.Next(5), Name = "ветчина" }; Burger.AddMeat(h); Console.WriteLine("Добавили ветчины"); MoneyCounter.LogBuyes(h); break; case 2: Sausage s = new Sausage { Weight = rnd.NextDouble() * rnd.Next(5), Name = "сосиска" }; Burger.AddMeat(s); Console.WriteLine("Добавили сосиску"); MoneyCounter.LogBuyes(s); break; } Thread.Sleep(40); } int randomMaxVegetables = rnd.Next(_maxItems[1]); for (int i = 0; i < randomMaxVegetables; i++) { int randVegetable = rnd.Next(3); switch (randVegetable) { case 0: Vegetable Tomato = new Vegetable() { Weight = rnd.NextDouble(), VegetableType = TypeOfVegetable.Tomato, Name = "красный помидор" }; Burger.AddVegetable(Tomato); Console.WriteLine("Добавили красного помидора"); MoneyCounter.LogBuyes(Tomato); break; case 1: Vegetable Onion = new Vegetable() { Weight = rnd.NextDouble(), VegetableType = TypeOfVegetable.Onion, Name = "лук репчатый" }; Burger.AddVegetable(Onion); Console.WriteLine("Добавили лука репчатого"); MoneyCounter.LogBuyes(Onion); break; case 2: Vegetable Cucumber = new Vegetable() { Weight = rnd.NextDouble(), VegetableType = TypeOfVegetable.Cucumber, Name = "соленый огурчик" }; Burger.AddVegetable(Cucumber); Console.WriteLine("Добавили соленого огурчика"); MoneyCounter.LogBuyes(Cucumber); break; } Thread.Sleep(40); } int randomMaxCheeseSlices = rnd.Next(_maxItems[2]); for (int i = 0; i < randomMaxCheeseSlices; i++) { MoneyCounter.LogBuyes(Burger.AddCheeseSlice()); Thread.Sleep(40); } Console.WriteLine("Ура ваш бургер был собран"); }
public void SpanwSausage() { sausageCooking = Instantiate(sausagePrefab, transform.position + new Vector3(0.0f, 0.0f, -1.0f), Quaternion.identity); sausageCookingScript = sausageCooking.GetComponent <Sausage>(); }
public SausageBurnAction(Burn burn) { this.burn = burn; _sausage = burn.gameObject.GetComponentInParent <Sausage>(); }
public SausageMoveAction(Sausage sausage, Vector2Int dir) { _dir = dir; _sausage = sausage; }
public static SausageField Cut(Sausage sausage) { return(new SausageField()); }
public ActionResult CreatePizza(string size, string name, bool?bacon, bool?bbq, bool?cheese, bool?mushroom, bool?onion, bool?pepperoni, bool?pepper, bool?pineapple, bool?sausage, bool?shrimp, int amt, bool?deliver, InfoViewModel infoView) { bool isNum = IsNumber(amt); if (ModelState.IsValid && !string.IsNullOrEmpty(size) && isNum) { double totalCost; Pizza aPizza = null; //Switch statement for the size of the pizza switch (size) { case "Small": aPizza = new Small(); break; case "Medium": aPizza = new Medium(); break; case "Large": aPizza = new Large(); break; } //If the topping was selected then it is added to the pizza if (bacon == true) { aPizza = new Bacon(aPizza); } if (bbq == true) { aPizza = new BBQ(aPizza); } if (cheese == true) { aPizza = new ExCheese(aPizza); } if (mushroom == true) { aPizza = new Mushroom(aPizza); } if (onion == true) { aPizza = new Onion(aPizza); } if (pepperoni == true) { aPizza = new Pepperoni(aPizza); } if (pepper == true) { aPizza = new Peppers(aPizza); } if (pineapple == true) { aPizza = new Pineapple(aPizza); } if (sausage == true) { aPizza = new Sausage(aPizza); } if (shrimp == true) { aPizza = new Shrimp(aPizza); } //Created a variable to contain and manipulate the cost totalCost = aPizza.GetCost(); infoView.Delivery = deliver; if (Session["cart"] == null) { List <CartItem> cart = new List <CartItem> { new CartItem { ID = 1, Pizza = aPizza, Quant = amt, ViewModel = infoView } }; Session["info"] = infoView; Session["cart"] = cart; Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant); } else { List <CartItem> cart = (List <CartItem>)Session["cart"]; int index = IsExist(aPizza); if (index != -1) { cart[index].Quant++; } else { int currentID = cart.Count(); cart.Add(new CartItem { ID = currentID, Pizza = aPizza, Quant = amt, ViewModel = infoView }); } Session["info"] = infoView; Session["cart"] = cart; Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant); } //Method sends order to database //aConnection.InsertPizzaOrder(aPizza, totalCost, name, amt, deliver, addy, city, zip, time); //Adds everything to a ViewBag to send to confirmation page //ViewBag.APizza = aPizza; //ViewBag.Total = totalCost; //ViewBag.Name = name; //ViewBag.Amt = amt; //ViewBag.Deliver = deliver; //ViewBag.Addy = addy; //ViewBag.City = city; //ViewBag.Zip = zip; //ViewBag.Time = time; return(RedirectToAction("DisplayCart")); } else { if (string.IsNullOrEmpty(size)) { TempData["Amt"] = "The amount must be a number"; TempData["Size"] = "A size must be selected"; } return(View("CreatePizzaForm", infoView)); } }
public ActionResult AddMorePizza(string size, string name, bool?bacon, bool?bbq, bool?cheese, bool?mushroom, bool?onion, bool?pepperoni, bool?pepper, bool?pineapple, bool?sausage, bool?shrimp, int amt) { if (!string.IsNullOrEmpty(size)) { double totalCost; Pizza aPizza = null; //Switch statement for the size of the pizza switch (size) { case "Small": aPizza = new Small(); break; case "Medium": aPizza = new Medium(); break; case "Large": aPizza = new Large(); break; } //If the topping was selected then it is added to the pizza if (bacon == true) { aPizza = new Bacon(aPizza); } if (bbq == true) { aPizza = new BBQ(aPizza); } if (cheese == true) { aPizza = new ExCheese(aPizza); } if (mushroom == true) { aPizza = new Mushroom(aPizza); } if (onion == true) { aPizza = new Onion(aPizza); } if (pepperoni == true) { aPizza = new Pepperoni(aPizza); } if (pepper == true) { aPizza = new Peppers(aPizza); } if (pineapple == true) { aPizza = new Pineapple(aPizza); } if (sausage == true) { aPizza = new Sausage(aPizza); } if (shrimp == true) { aPizza = new Shrimp(aPizza); } //Created a variable to contain and manipulate the cost totalCost = aPizza.GetCost(); if (Session["cart"] == null) { List <CartItem> cart = new List <CartItem> { new CartItem { ID = 1, Pizza = aPizza, Quant = amt, ViewModel = (InfoViewModel)Session["info"] } }; Session["cart"] = cart; Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant); } else { List <CartItem> cart = (List <CartItem>)Session["cart"]; int index = IsExist(aPizza); if (index != -1) { cart[index].Quant++; } else { int currentID = cart.Count(); cart.Add(new CartItem { ID = currentID, Pizza = aPizza, Quant = amt, ViewModel = (InfoViewModel)Session["info"] }); } Session["cart"] = cart; Session["Total"] = cart.Sum(item => item.Pizza.GetCost() * item.Quant); } return(RedirectToAction("DisplayCart")); } else { if (string.IsNullOrEmpty(size)) { TempData["Amt"] = "The amount must be a number"; TempData["Size"] = "A size must be selected"; } return(View("AddMorePizzaForm")); } }