示例#1
0
 public static Ingredient ModelToDto(IngredientModel ingredient)
 {
     return(new Ingredient()
     {
         Key = ingredient.ID,
         Value = ingredient.Name.Trim()
     });
 }
示例#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)
     });
 }
示例#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)
     });
 }