public async Task UpdateAsync(YeastDto yeastDto) { var yeast = Mapper.Map<YeastDto, Yeast>(yeastDto); await _yeastRepository.UpdateAsync(yeast); var result = await _yeastRepository.GetSingleAsync(yeastDto.Id, "Supplier"); var mappedResult = Mapper.Map<Yeast, YeastDto>(result); await _yeastElasticsearch.UpdateAsync(mappedResult); }
public async Task UpdateAsync(YeastDto yeastDto) { await _client.MapAsync<YeastDto>(d => d.Properties(p => p .String(s => s.Name(n => n.Name).Analyzer("autocomplete")) .String(s => s.Name(n => n.ProductCode).Analyzer("autocomplete")) )); await _client.IndexAsync(yeastDto); }
public async Task<IHttpActionResult> PutYeast(int id, YeastDto yeastDto) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != yeastDto.Id) { return BadRequest(); } await _yeastService.UpdateAsync(yeastDto); return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostYeast(YeastDto yeastDto) { if (!ModelState.IsValid) { return BadRequest(ModelState); } var result = await _yeastService.AddAsync(yeastDto); return CreatedAtRoute("DefaultApi", new { controller = "yeasts", }, result); }