public string GetSandwichCost() { //double output = 0.0; Sandwich sandwich = db.Sandwiches.Find(this.SandwichId); double temp = sandwich.GetCost(); temp *= 100; temp = Math.Round(temp); temp /= 100; string output = "$" + temp.ToString(); return(output); }
public string GetIngredients(Sandwich sandwich) { StringBuilder ingredientList = new StringBuilder(); foreach (Ingredient i in sandwich.Ingredients) { string ingredientName = i.Name; ingredientList.Append(ingredientName); ingredientList.Append(", "); } int index = ingredientList.Length; if (index >= 2) { ingredientList.Remove(index - 2, 2); } return(ingredientList.ToString()); }