You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SAE-2.01/MCTG/ConsoleApp/Menu/ShowRecipeInfos.cs

38 lines
1021 B

using ConsoleApp.Menu.Core;
using Model;
using System.Text;
namespace ConsoleApp.Menu
{
internal class ShowRecipeInfos : PlainText
{
public Recipe Recipe { get; private set; }
public ShowRecipeInfos(Recipe recipe)
: base("")
{
Recipe = recipe;
}
public override void Display()
{
StringBuilder sb = new StringBuilder($"[Recipe n°{Recipe.Id}] - {Recipe.Title}\n");
foreach (PreparationStep ps in Recipe.PreparationSteps)
{
sb.AppendFormat("\t* {0}\n", ps.ToString());
}
sb.AppendLine();
sb.AppendLine(Recipe.ConcatIngredients());
sb.AppendLine();
foreach (Review review in Recipe.Reviews)
{
sb.AppendLine(review.ToString());
}
sb.AppendLine();
sb.AppendLine($"Posted by: {Recipe.AuthorMail?.ToString()}");
Console.WriteLine(sb);
}
}
}