|
|
@ -1,6 +1,7 @@
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
using System.Runtime.CompilerServices;
|
|
|
|
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Model
|
|
|
|
namespace Model
|
|
|
@ -55,7 +56,13 @@ namespace Model
|
|
|
|
Title = title;
|
|
|
|
Title = title;
|
|
|
|
PreparationSteps = new List<PreparationStep>(preparationSteps);
|
|
|
|
PreparationSteps = new List<PreparationStep>(preparationSteps);
|
|
|
|
|
|
|
|
|
|
|
|
if (id == null) Id = new Random().Next();
|
|
|
|
if (id == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var randomGenerator = RandomNumberGenerator.Create();
|
|
|
|
|
|
|
|
byte[] data = new byte[16];
|
|
|
|
|
|
|
|
randomGenerator.GetBytes(data);
|
|
|
|
|
|
|
|
Id = Math.Abs(BitConverter.ToInt16(data));
|
|
|
|
|
|
|
|
}
|
|
|
|
else Id = (int)id;
|
|
|
|
else Id = (int)id;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
|
@ -68,6 +75,13 @@ namespace Model
|
|
|
|
return Title.Equals(other.Title) && PreparationSteps.Equals(other.PreparationSteps);
|
|
|
|
return Title.Equals(other.Title) && PreparationSteps.Equals(other.PreparationSteps);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object? obj)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var item = obj as Recipe;
|
|
|
|
|
|
|
|
if (item == null) return false;
|
|
|
|
|
|
|
|
return Equals(obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
public override int GetHashCode()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return Id.GetHashCode();
|
|
|
|
return Id.GetHashCode();
|
|
|
|