|
|
|
@ -25,6 +25,9 @@ namespace Model
|
|
|
|
|
[DataMember(Name = "id")]
|
|
|
|
|
public int Id { get; init; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// List of reviews of this recipe.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataMember(Name = "reviews")]
|
|
|
|
|
public List<Review> Reviews { get; private set; }
|
|
|
|
|
|
|
|
|
@ -94,12 +97,31 @@ namespace Model
|
|
|
|
|
: this(title, null, new List<Review>(), preparationSteps)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// <inheritdoc cref="Recipe.Recipe(string, int?, List{Review}, PreparationStep[])"/>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="title">The title of the recipe.</param>
|
|
|
|
|
/// <param name="id">The id of the recipe. If not given, get a new id.</param>
|
|
|
|
|
/// <param name="preparationSteps">The steps of the preparation of the meal.</param>
|
|
|
|
|
public Recipe(string title, int? id, params PreparationStep[] preparationSteps)
|
|
|
|
|
: this(title, id, new List<Review>(), preparationSteps)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Methods
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Add a review for the recipe.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="review">The new review to add.</param>
|
|
|
|
|
public void AddReview(Review review)
|
|
|
|
|
=> Reviews.Add(review);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a string representing all the reviews and their informations.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string GetReviews()
|
|
|
|
|
{
|
|
|
|
|
StringBuilder sb = new StringBuilder("Reviews:\n------------------------------\n");
|
|
|
|
|