diff --git a/MCTG/Model/Ingredient.cs b/MCTG/Model/Ingredient.cs index 46e5d36..79b38b7 100644 --- a/MCTG/Model/Ingredient.cs +++ b/MCTG/Model/Ingredient.cs @@ -1,16 +1,20 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace Model { + [DataContract(Name ="ingredient")] public class Ingredient { #region Attributes - + [DataMember(Name ="id")] private string name = ""; + + [DataMember(Name ="quantity")] private Quantity quantity = new Quantity(1, Unit.unit) ; #endregion diff --git a/MCTG/Model/Quantity.cs b/MCTG/Model/Quantity.cs index 7378634..af88cd8 100644 --- a/MCTG/Model/Quantity.cs +++ b/MCTG/Model/Quantity.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; @@ -10,19 +11,24 @@ namespace Model /// Quantity is a class which is associate to Ingedients. It represents the quantity of every ingredient with an enum /// to indicate the unit of the quantity. /// + [DataContract(Name ="quantity")] public class Quantity { #region Attributes /// /// get the quatity of ingredient /// + [DataMember(Name ="digit")] private int number; /// /// have the Unit enum of the quantity of ingredient /// + [DataMember(Name ="unit")] private Unit unit; #endregion + + #region Properties /// /// Represents the quantity in digits. The null value raise an argumentException. /// @@ -44,6 +50,8 @@ namespace Model set => unit = value; } + #endregion + #region Constructor /// diff --git a/MCTG/Model/Unit.cs b/MCTG/Model/Unit.cs index b745126..8cf2b21 100644 --- a/MCTG/Model/Unit.cs +++ b/MCTG/Model/Unit.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; @@ -10,6 +11,7 @@ namespace Model /// Unit is an Enum that represents the units of quantities /// /// + [DataContract(Name ="enumUnit")] public enum Unit { unit, kG, mG, G, L, cL, mL }; }