add base model classes

pull/34/head
Maxime BATISTA 2 years ago
parent f332b5a0e4
commit d556920e4f

@ -1,4 +1,5 @@
using System; using ShoopNCook.Pages;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -11,6 +12,8 @@ namespace ShoopNCook.Core
private readonly User user; private readonly User user;
private readonly string email; private readonly string email;
private List<RecipeInformation> favoriteRecipes;
public Account(User user, string email) public Account(User user, string email)
{ {
this.user = user; this.user = user;
@ -19,5 +22,12 @@ namespace ShoopNCook.Core
public User User { get => user; } public User User { get => user; }
public string Email { get => email; } public string Email { get => email; }
public List<RecipeInformation> Favorites { get => favoriteRecipes; }
public void AddFavoriteRecipe(RecipeInformation recipe)
{
favoriteRecipes.Add(recipe);
}
} }
} }

@ -8,39 +8,28 @@ namespace ShoopNCook.Core
{ {
internal class Recipe internal class Recipe
{ {
private string name;
private string description;
private User owner;
private Uri image;
private float averageNote;
private List<Ingredient> ingredients; private readonly RecipeInformation info;
private List<PreparationStep> steps; private readonly User owner;
private readonly List<Ingredient> ingredients;
private readonly List<PreparationStep> steps;
public Recipe( public Recipe(
string name, RecipeInformation info,
string description,
User owner, User owner,
Uri image,
float averageNote,
List<Ingredient> ingredients, List<Ingredient> ingredients,
List<PreparationStep> steps) List<PreparationStep> steps)
{ {
this.name = name; this.info = info;
this.description = description;
this.owner = owner; this.owner = owner;
this.image = image;
this.averageNote = averageNote;
this.ingredients = ingredients; this.ingredients = ingredients;
this.steps = steps; this.steps = steps;
} }
public string Name { get => name; } public RecipeInformation Info { get => info; }
public string Description { get => description; }
public User Owner { get => owner; } public User Owner { get => owner; }
public Uri Image { get => image; }
public float AverageNote { get => averageNote; }
public List<Ingredient> Ingredients { get => ingredients; } public List<Ingredient> Ingredients { get => ingredients; }
public List<PreparationStep> Steps { get => steps; } public List<PreparationStep> Steps { get => steps; }
} }

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoopNCook.Core
{
internal class RecipeInformation
{
private string name;
private string description;
private Uri image;
private float averageNote;
private int cookTimeMinutes;
private int caloriesPerGuest;
public RecipeInformation(string name, string description, Uri image, float averageNote, int cookTimeMinutes, int caloriesPerGuest)
{
this.name = name;
this.description = description;
this.image = image;
this.averageNote = averageNote;
this.cookTimeMinutes = cookTimeMinutes;
this.caloriesPerGuest = caloriesPerGuest;
}
public string Name { get => name; }
public string Description { get => description; }
public Uri Image { get => image; }
public float AverageNote { get => averageNote; }
public int CookTimeMinutes { get => cookTimeMinutes; }
public int CaloriesPerGuest { get => caloriesPerGuest; }
}
}
Loading…
Cancel
Save