コード例 #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
ファイル: Recipe.cs プロジェクト: killwort/BluePrintAssembler
 public Recipe(Domain.Recipe value)
 {
     MyRecipe       = value;
     SelectProducer = new DelegateCommand <ProducingEntity>(SelectProducerImpl);
 }