|
|
|
@ -31,6 +31,12 @@ namespace Model
|
|
|
|
|
[DataMember(Name = "reviews")]
|
|
|
|
|
public List<Review> Reviews { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Author of the recipe.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataMember(Name = "author")]
|
|
|
|
|
public User? Author { get; private set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The Title of the recipe. <br/>
|
|
|
|
|
/// Set to "No title." when the value passed is null, empty or contain white spaces.
|
|
|
|
@ -69,7 +75,7 @@ namespace Model
|
|
|
|
|
/// <param _name="reviews">Thr list of reviews.</param>
|
|
|
|
|
/// <param _name="ingredients">Thr list of ingredients.</param>
|
|
|
|
|
/// <param _name="preparationSteps">The steps of the preparation of the meal</param>
|
|
|
|
|
public Recipe(string title, int? id,
|
|
|
|
|
public Recipe(string title, int? id, User? author,
|
|
|
|
|
List<Review> reviews, List<Ingredient> ingredients,
|
|
|
|
|
params PreparationStep[] preparationSteps)
|
|
|
|
|
{
|
|
|
|
@ -77,6 +83,7 @@ namespace Model
|
|
|
|
|
PreparationSteps = new List<PreparationStep>(preparationSteps);
|
|
|
|
|
Ingredients = ingredients;
|
|
|
|
|
Reviews = reviews;
|
|
|
|
|
Author = author;
|
|
|
|
|
|
|
|
|
|
if (id == null)
|
|
|
|
|
{
|
|
|
|
@ -93,7 +100,7 @@ namespace Model
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param _name="title">The title of the recipe.</param>
|
|
|
|
|
public Recipe(string title)
|
|
|
|
|
: this(title, null, new List<Review>(), new List<Ingredient>())
|
|
|
|
|
: this(title, null, null, new List<Review>(), new List<Ingredient>())
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -103,7 +110,7 @@ namespace Model
|
|
|
|
|
/// <param _name="title">The title of the recipe.</param>
|
|
|
|
|
/// <param _name="preparationSteps">The steps of the preparation of the meal.</param>
|
|
|
|
|
public Recipe(string title, params PreparationStep[] preparationSteps)
|
|
|
|
|
: this(title, null, new List<Review>(), new List<Ingredient>(), preparationSteps)
|
|
|
|
|
: this(title, null, null, new List<Review>(), new List<Ingredient>(), preparationSteps)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -114,7 +121,7 @@ namespace Model
|
|
|
|
|
/// <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>(), new List<Ingredient>(), preparationSteps)
|
|
|
|
|
: this(title, id, null, new List<Review>(), new List<Ingredient>(), preparationSteps)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -127,7 +134,7 @@ namespace Model
|
|
|
|
|
/// <param _name="preparationSteps">The steps of the preparation of the meal.</param>
|
|
|
|
|
public Recipe(string title, int? id, List<Ingredient> ingredients,
|
|
|
|
|
params PreparationStep[] preparationSteps)
|
|
|
|
|
: this(title, id, new List<Review>(), ingredients, preparationSteps)
|
|
|
|
|
: this(title, id, null, new List<Review>(), ingredients, preparationSteps)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
@ -203,6 +210,8 @@ namespace Model
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine(review.ToString());
|
|
|
|
|
}
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
sb.AppendLine($"Posted by: {Author?.ToString()}");
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|