public async Task UpdateHopAsync(HopDto hopDto) { var hop = Mapper.Map<HopDto, Hop>(hopDto); await _hopRepository.UpdateAsync(hop); var result = await _hopRepository.GetSingleAsync(hopDto.Id,"Flavours.Flavour", "Origin", "Substituts"); var mappedResult = Mapper.Map<Hop, HopDto>(result); await _hopElasticsearch.UpdateAsync(mappedResult); }
public async Task<IHttpActionResult> PostHop(HopDto hopDto) { if (!ModelState.IsValid) { return BadRequest(ModelState); } var result = await _hopService.AddHopAsync(hopDto); return CreatedAtRoute("DefaultApi", new { controller = "hops", }, result); }
public async Task<IHttpActionResult> PutHop(int id, HopDto hopDto) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != hopDto.Id) { return BadRequest(); } await _hopService.UpdateHopAsync(hopDto); return StatusCode(HttpStatusCode.NoContent); }
public async Task UpdateAsync(HopDto hop) { // Adds an analayzer to the name property in FermentableDto object. await _client.MapAsync<HopDto>(d => d.Properties(p => p.String(s => s.Name(n => n.Name).Analyzer("autocomplete")))); var index = await _client.IndexAsync<HopDto>(hop); }