Ejemplo n.º 1
0
 public static Instruction ModelToDto(InstructionModel instruction)
 {
     return(new Instruction()
     {
         Key = instruction.ID,
         Value = instruction.Step.Trim()
     });
 }
Ejemplo n.º 2
0
 public static Recipe ModelToDto(RecipeModel recipeModel)
 {
     return(new Recipe()
     {
         RecipeID = recipeModel.RecipeID,
         Name = recipeModel.Name.Trim(),
         GlutenFree = recipeModel.GlutenFree,
         DairyFree = recipeModel.DairyFree,
         Vegetarian = recipeModel.Vegetarian,
         Vegan = recipeModel.Vegan,
         Nuts = recipeModel.Nuts,
         Instruction = InstructionModel.ModelToDto(recipeModel.Instructions),
         Ingredient = IngredientModel.ModelToDto(recipeModel.Ingredients)
     });
 }
Ejemplo n.º 3
0
 public static RecipeModel DtoToModel(Recipe recipe)
 {
     return(new RecipeModel()
     {
         RecipeID = recipe.RecipeID,
         Name = recipe.Name.Trim(),
         GlutenFree = recipe.GlutenFree ?? false,
         DairyFree = recipe.DairyFree ?? false,
         Vegetarian = recipe.Vegetarian ?? false,
         Vegan = recipe.Vegan ?? false,
         Nuts = recipe.Nuts ?? false,
         Ingredients = IngredientModel.DtoToModelToList(recipe.Ingredient),
         Instructions = InstructionModel.DtoToModelToList(recipe.Instruction)
     });
 }