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.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

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

@ -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
/// <list type="Unit, kG, mG, G, L, cL, mL"/>
/// </summary>
[DataContract(Name ="enumUnit")]
public enum Unit
{ unit, kG, mG, G, L, cL, mL };
}

Loading…
Cancel
Save