예제 #1
0
 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);
 }
예제 #2
0
 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);
 }
예제 #3
0
        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);
 }