Пример #1
0
        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);
        }
Пример #2
0
        public void CreateRecipe(Domain.Recipe recipe)
        {
            var sqlRecipe = recipe.ConvertToSqlRecipe();



            _context.Recipes.Add(sqlRecipe);
            _context.SaveChanges();
        }
Пример #3
0
 public void UpdateRecipe(Domain.Recipe recipe)
 {
     throw new NotImplementedException();
 }
Пример #4
0
 public Recipe(Domain.Recipe value)
 {
     MyRecipe       = value;
     SelectProducer = new DelegateCommand <ProducingEntity>(SelectProducerImpl);
 }