コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: Sandwich.cs プロジェクト: seanbass/InventoryDash
        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());
        }