implementation of datacontract on ingredient
continuous-integration/drone/push Build is passing Details

pull/47/head
Roxane ROSSETTO 2 years ago
parent 7758ed4401
commit 6e5b6ca7a9

@ -1,16 +1,20 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Model namespace Model
{ {
[DataContract(Name ="ingredient")]
public class Ingredient public class Ingredient
{ {
#region Attributes #region Attributes
[DataMember(Name ="id")]
private string name = ""; private string name = "";
[DataMember(Name ="quantity")]
private Quantity quantity = new Quantity(1, Unit.unit) ; private Quantity quantity = new Quantity(1, Unit.unit) ;
#endregion #endregion

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; 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 /// 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. /// to indicate the unit of the quantity.
/// </summary> /// </summary>
[DataContract(Name ="quantity")]
public class Quantity public class Quantity
{ {
#region Attributes #region Attributes
/// <summary> /// <summary>
/// get the quatity of ingredient /// get the quatity of ingredient
/// </summary> /// </summary>
[DataMember(Name ="digit")]
private int number; private int number;
/// <summary> /// <summary>
/// have the Unit enum of the quantity of ingredient /// have the Unit enum of the quantity of ingredient
/// </summary> /// </summary>
[DataMember(Name ="unit")]
private Unit unit; private Unit unit;
#endregion #endregion
#region Properties
/// <summary> /// <summary>
/// Represents the quantity in digits. The null value raise an argumentException. /// Represents the quantity in digits. The null value raise an argumentException.
/// </summary> /// </summary>
@ -44,6 +50,8 @@ namespace Model
set => unit = value; set => unit = value;
} }
#endregion
#region Constructor #region Constructor
/// <summary> /// <summary>

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.Serialization;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -10,6 +11,7 @@ namespace Model
/// Unit is an Enum that represents the units of quantities /// Unit is an Enum that represents the units of quantities
/// <list type="Unit, kG, mG, G, L, cL, mL"/> /// <list type="Unit, kG, mG, G, L, cL, mL"/>
/// </summary> /// </summary>
[DataContract(Name ="enumUnit")]
public enum Unit public enum Unit
{ unit, kG, mG, G, L, cL, mL }; { unit, kG, mG, G, L, cL, mL };
} }

Loading…
Cancel
Save