diff --git a/MCTG/DataPersistence/DataManager.cs b/MCTG/Model/Managers/DataManager.cs similarity index 99% rename from MCTG/DataPersistence/DataManager.cs rename to MCTG/Model/Managers/DataManager.cs index a06d94d..9b5277c 100644 --- a/MCTG/DataPersistence/DataManager.cs +++ b/MCTG/Model/Managers/DataManager.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace DataPersistence +namespace Model { /// /// Define the manager of the data. This is where all the data are put, and where we call the loading and the saving of them. diff --git a/MCTG/DataPersistence/IDataManager.cs b/MCTG/Model/Managers/IDataManager.cs similarity index 98% rename from MCTG/DataPersistence/IDataManager.cs rename to MCTG/Model/Managers/IDataManager.cs index 95209d8..c8a4ca6 100644 --- a/MCTG/DataPersistence/IDataManager.cs +++ b/MCTG/Model/Managers/IDataManager.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace DataPersistence +namespace Model { /// /// Interface that define the methods of a data serializer. diff --git a/MCTG/Model/Recipes/Recipe.cs b/MCTG/Model/Recipes/Recipe.cs index 84c168d..472f438 100644 --- a/MCTG/Model/Recipes/Recipe.cs +++ b/MCTG/Model/Recipes/Recipe.cs @@ -31,6 +31,12 @@ namespace Model [DataMember(Name = "reviews")] public List Reviews { get; private set; } + /// + /// Author of the recipe. + /// + [DataMember(Name = "author")] + public User? Author { get; private set; } + /// /// The Title of the recipe.
/// Set to "No title." when the value passed is null, empty or contain white spaces. @@ -69,7 +75,7 @@ namespace Model /// Thr list of reviews. /// Thr list of ingredients. /// The steps of the preparation of the meal - public Recipe(string title, int? id, + public Recipe(string title, int? id, User? author, List reviews, List ingredients, params PreparationStep[] preparationSteps) { @@ -77,6 +83,7 @@ namespace Model PreparationSteps = new List(preparationSteps); Ingredients = ingredients; Reviews = reviews; + Author = author; if (id == null) { @@ -93,7 +100,7 @@ namespace Model ///
/// The title of the recipe. public Recipe(string title) - : this(title, null, new List(), new List()) + : this(title, null, null, new List(), new List()) { } @@ -103,7 +110,7 @@ namespace Model /// The title of the recipe. /// The steps of the preparation of the meal. public Recipe(string title, params PreparationStep[] preparationSteps) - : this(title, null, new List(), new List(), preparationSteps) + : this(title, null, null, new List(), new List(), preparationSteps) { } @@ -114,7 +121,7 @@ namespace Model /// The id of the recipe. If not given, get a new id. /// The steps of the preparation of the meal. public Recipe(string title, int? id, params PreparationStep[] preparationSteps) - : this(title, id, new List(), new List(), preparationSteps) + : this(title, id, null, new List(), new List(), preparationSteps) { } @@ -127,7 +134,7 @@ namespace Model /// The steps of the preparation of the meal. public Recipe(string title, int? id, List ingredients, params PreparationStep[] preparationSteps) - : this(title, id, new List(), ingredients, preparationSteps) + : this(title, id, null, new List(), ingredients, preparationSteps) { } #endregion @@ -203,8 +210,10 @@ namespace Model { sb.AppendLine(review.ToString()); } + sb.AppendLine(); + sb.AppendLine($"Posted by: {Author?.ToString()}"); return sb.ToString(); } #endregion } -} \ No newline at end of file +}