public static Database.Recipes.Recipe ToDatabaseModel(Domain.Recipe d) { if (d == null) { return(null); } var db = new Database.Recipes.Recipe { Id = d.Id, Name = d.Name, Steps = d.Steps, PlannedRecipes = new List <Database.Recipes.PlannedRecipe>() }; db.RecipeItems = d.Ingredients?.Select(ingredient => new Database.Items.RecipeItem { Item = ToDatabaseModel(ingredient.Item), Recipe = db })?.ToList() ?? null; db.Tags = d.Tags?.Select(tag => new Database.Tagging.RecipeTag { Tag = ToDatabaseModel(tag), Recipe = db })?.ToList() ?? null; return(db); }
public void CreateRecipe(Domain.Recipe recipe) { var sqlRecipe = recipe.ConvertToSqlRecipe(); _context.Recipes.Add(sqlRecipe); _context.SaveChanges(); }
public void UpdateRecipe(Domain.Recipe recipe) { throw new NotImplementedException(); }
public Recipe(Domain.Recipe value) { MyRecipe = value; SelectProducer = new DelegateCommand <ProducingEntity>(SelectProducerImpl); }