コード例 #1
0
        public static PizzaModel AssignIngredients(PizzaModel model, List <IngredientModel> ingredients)
        {
            UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository();

            foreach (var ing in ingredients)
            {
                PizzaIngredientModel pizIng = new PizzaIngredientModel
                {
                    Id         = new Guid(),
                    Ingredient = ing,
                    PizzaId    = model.Id
                };
                unitOfWork.PizzaIngredientRepository.AddPizza_Ingredients(PizzaIngredientFactory.ConvertPizzaIngredientModel(pizIng));
                model.PizzaIngredients.Add(pizIng);
            }
            unitOfWork.PizzaRepository.UpdatePizza(PizzaFactory.ConvertPizzaModel(model));
            return(model);
        }