コード例 #1
0
        protected override IList <HopStepDto> ResolveCore(FermentationStep step)
        {
            var hopStepDtoList = new List <HopStepDto>();

            foreach (var item in step.Hops)
            {
                var hopStepDto = new HopStepDto()
                {
                    HopId      = item.HopId,
                    StepNumber = item.StepNumber,
                    Amount     = item.Amount,
                    AAValue    = item.AAValue,
                    RecipeId   = item.RecipeId,
                };
                var hop = _hopElasticsearch.GetSingle(item.HopId);
                if (hop == null)
                {
                    hop = Mapper.Map <Hop, HopDto>(_hopRepository.GetSingle(item.HopId));
                }
                hopStepDto.Name   = hop.Name;
                hopStepDto.Origin = hop.Origin;
                //hopStepDto.Flavours = hop.Flavours;
                //hopStepDto.FlavourDescription = hop.FlavourDescription;
                hopStepDto.HopForm = Mapper.Map <HopForm, DTO>(_hopRepository.GetForm(item.HopFormId));
                hopStepDtoList.Add(hopStepDto);
            }
            return(hopStepDtoList);
        }
コード例 #2
0
        public HopDto GetSingle(int id)
        {
            var hopDto = _hopElasticsearch.GetSingle(id);

            if (hopDto != null)
            {
                return(hopDto);
            }
            var hop = _hopRepository.GetSingle(id, "Flavours.Flavour", "Origin", "Substituts");

            hopDto = Mapper.Map <Hop, HopDto>(hop);
            return(hopDto);
        }