protected override IList <BoilStepHop> ResolveCore(BoilStepDto boilStep)
        {
            var boilStepHops = new List <BoilStepHop>();

            foreach (var temp in boilStep.Ingredients.Where(i => i.Type == "hop"))
            {
                var hopStepDto  = (HopStepDto)temp;
                var boilStepHop = AutoMapper.Mapper.Map <HopStepDto, BoilStepHop>(hopStepDto);
                boilStepHops.Add(boilStepHop);
            }
            return(boilStepHops);
        }
        protected override IList <BoilStepOther> ResolveCore(BoilStepDto boilStepDto)
        {
            var boilStepOthers = new List <BoilStepOther>();

            foreach (var temp in boilStepDto.Ingredients.Where(i => i.Type == "other"))
            {
                var otherStepDto = (OtherStepDto)temp;
                //var boilStepOther = Mapper.Map<OtherStepDto,BoilStepOther>(otherStepDto);
                //boilStepOthers.Add(boilStepOther);
            }
            return(boilStepOthers);
        }
        private static BoilStepDto GetBoilStepDto(RecipeDto recipeDto, int time)
        {
            var boilSteps = recipeDto.Steps.OfType <BoilStepDto>();
            var boilStep  = boilSteps?.FirstOrDefault(b => b.Length == time);

            if (boilStep != null)
            {
                return(boilStep);
            }
            boilStep = new BoilStepDto
            {
                Length      = time,
                Ingredients = new List <IIngredientStepDto>(),
            };
            recipeDto.Steps.Add(boilStep);
            return(boilStep);
        }
        private static BoilStepDto GetBoilStepDto(RecipeDto recipeDto, int time)
        {
            var boilStep = recipeDto.BoilSteps.SingleOrDefault(b => b.Length == time);

            if (boilStep != null)
            {
                return(boilStep);
            }
            boilStep = new BoilStepDto
            {
                Length       = time,
                Hops         = new List <HopStepDto>(),
                Fermentables = new List <FermentableStepDto>(),
                Others       = new List <OtherStepDto>()
            };
            recipeDto.BoilSteps.Add(boilStep);
            return(boilStep);
        }