protected override IList <HopStepDto> ResolveCore(BoilStep 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; //TODO: Add elasticsearch on hop form. hopStepDto.HopForm = Mapper.Map <HopForm, DTO>(_hopRepository.GetForm(item.HopFormId)); hopStepDtoList.Add(hopStepDto); } return(hopStepDtoList); }
// private IFermentableElasticsearch _fermentableElasticsearch = new FermentableElasticsearch(); // private IFermentableRepository _fermentableRepository = new FermentableDapperRepository(); protected override IList <FermentableStepDto> ResolveCore(BoilStep step) { var fermentableStepDtoList = new List <FermentableStepDto>(); // foreach (var item in step.Fermentables) // { // var fermentable = _fermentableElasticsearch.GetSingle(item.FermentableId); // if (fermentable == null) // { // fermentable = Mapper.Map<Fermentable,FermentableDto>(_fermentableRepository.GetSingle(item.FermentableId)); // } // var fermentableStepDto = new FermentableStepDto(); // // fermentableStepDto.FermentableId = item.FermentableId; // fermentableStepDto.Amount = item.Amount; // fermentableStepDto.Supplier = fermentable.Supplier; // fermentableStepDto.SubType = fermentable.Type; // fermentableStepDto.Name = fermentable.Name; // fermentableStepDto.PPG = fermentable.PPG; // if (item.Lovibond == 0) // { // fermentableStepDto.Lovibond = item.Lovibond; // } // else // { // fermentableStepDto.Lovibond = fermentable.Lovibond; // } // fermentableStepDtoList.Add(fermentableStepDto); // } return(fermentableStepDtoList); }
protected override IList <FermentableStepDto> ResolveCore(BoilStep step) { var fermentableStepDtoList = new List <FermentableStepDto>(); foreach (var item in step.Fermentables) { var fermentable = _fermentableElasticsearch.GetSingle(item.FermentableId); if (fermentable == null) { fermentable = Mapper.Map <Fermentable, FermentableDto>(_fermentableRepository.GetSingle(item.FermentableId)); } var fermentableStepDto = new FermentableStepDto(); fermentableStepDto.FermentableId = item.FermentableId; fermentableStepDto.StepNumber = item.StepNumber; fermentableStepDto.Amount = item.Amount; fermentableStepDto.Supplier = fermentable.Supplier; fermentableStepDto.Type = fermentable.Type; fermentableStepDto.Name = fermentable.Name; fermentableStepDto.PPG = fermentable.PPG; fermentableStepDto.RecipeId = item.RecipeId; if (item.Lovibond == 0) { fermentableStepDto.Lovibond = item.Lovibond; } else { fermentableStepDto.Lovibond = fermentable.Lovibond; } fermentableStepDtoList.Add(fermentableStepDto); } return(fermentableStepDtoList); }
protected override IList <IIngredientStepDto> ResolveCore(BoilStep source) { var ingredients = new List <IIngredientStepDto>(); // var hops = Mapper.Map<ICollection<BoilStepHop>, IList<HopStepDto>>(source.Hops); // ingredients.AddRange(hops); // var fermentables = Mapper.Map<ICollection<BoilStepFermentable>, IList<FermentableStepDto>>(source.Fermentables); // ingredients.AddRange(fermentables); // var others = Mapper.Map<ICollection<BoilStepOther>, IList<OtherStepDto>>(source.Others); // ingredients.AddRange(others); return(ingredients); }
private void AddProfile_Click(object sender, RoutedEventArgs e) { IStep step = new BoilStep { LengthMinutes = BoilMinutes, Temperature = BrewProfileSettings.Instance.MinimumBoilingTemperature, }; Items.Add(step); var profile = new BrewProfile(ProfileName, BoilMinutes, Items.ToList()); this.Frame.Navigate(typeof(AddIngredients), profile); }
protected override IList <OtherStepDto> ResolveCore(BoilStep step) { var otherStepDtoList = new List <OtherStepDto>(); foreach (var item in step.Others) { var otherStepDto = new OtherStepDto() { OtherId = item.OtherId, Amount = item.Amount, RecipeId = item.RecipeId, }; var other = _otherElasticsearch.GetSingle(item.OtherId); if (other == null) { other = Mapper.Map <Other, OtherDto>(_otherRepository.GetSingle(item.OtherId)); } otherStepDto.Name = other.Name; otherStepDto.Type = other.Type; otherStepDtoList.Add(otherStepDto); } return(otherStepDtoList); }
// private IOtherElasticsearch _otherElasticsearch = new OtherElasticsearch(); // private IOtherRepository _otherRepository = new OtherDapperRepository(); protected override IList <OtherStepDto> ResolveCore(BoilStep step) { var otherStepDtoList = new List <OtherStepDto>(); // foreach (var item in step.Others) // { // // var otherStepDto = new OtherStepDto() // { // OtherId = item.OtherId, // Amount = item.Amount, // }; // var other = _otherElasticsearch.GetSingle(item.OtherId); // if (other == null) // { // other = Mapper.Map<Other, OtherDto>(_otherRepository.GetSingle(item.OtherId)); // } // otherStepDto.Name = other.Name; // otherStepDto.SubType = other.Type; // otherStepDtoList.Add(otherStepDto); // } return(otherStepDtoList); }