public async Task UpdateAsync(OriginDto originDto) { var origin = Mapper.Map<OriginDto, Origin>(originDto); await _originRespository.UpdateAsync(origin); var result = await _originRespository.GetSingleAsync(originDto.Id); var mappedResult = Mapper.Map<Origin, OriginDto>(result); await _originElasticsearch.UpdateAsync(mappedResult); }
public async Task<OriginDto> AddAsync(OriginDto otherDto) { var origin = Mapper.Map<OriginDto, Origin>(otherDto); await _originRespository.AddAsync(origin); var result = await _originRespository.GetSingleAsync(origin.OriginId); var mappedResult = Mapper.Map<Origin, OriginDto>(result); await _originElasticsearch.UpdateAsync(mappedResult); return mappedResult; }
public async Task<IHttpActionResult> PutOrigin(int id, OriginDto origin) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != origin.Id) { return BadRequest(); } await _originService.UpdateAsync(origin); return StatusCode(HttpStatusCode.NoContent); }
public async Task UpdateAsync(OriginDto originDto) { await _client.MapAsync<OriginDto>(d => d.Properties(p => p.String(s => s.Name(n => n.Name).Analyzer("autocomplete")))); var index = await _client.IndexAsync<OriginDto>(originDto); }
public async Task<IHttpActionResult> PostOrigin(OriginDto origin) { if (!ModelState.IsValid) { return BadRequest(ModelState); } var result = await _originService.AddAsync(origin); return CreatedAtRoute("DefaultApi", new { controller= "origins", }, result); }