public async Task UpdateAsync(GlassDto glassDto)
 {
     var glass = Mapper.Map<GlassDto, Glass>(glassDto);
     await _glassRepository.UpdateAsync(glass);
     var result = await _glassRepository.GetSingleAsync(glassDto.Id);
     var mappedResult = Mapper.Map<Glass, GlassDto>(result);
     await _glassElasticsearch.UpdateAsync(mappedResult);
 }
        public async Task<IHttpActionResult> PostGlass(GlassDto glassDto)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            await _glassService.AddAsync(glassDto);
            return CreatedAtRoute("DefaultApi", new { controller = "others", }, glassDto);
        }
        public async Task<IHttpActionResult> PutGlass(int id, GlassDto glassDto)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != glassDto.Id)
            {
                return BadRequest();
            }
            await _glassService.UpdateAsync(glassDto);
            return StatusCode(HttpStatusCode.NoContent);
        }
 public async Task<IIndexResponse> UpdateAsync(GlassDto glassDto)
 {
     // Adds an analayzer to the name property in FermentableDto object.
     await _client.MapAsync<GlassDto>(d => d.Properties(p => p.String(s => s.Name(n => n.Name).Analyzer("autocomplete"))));
     return await _client.IndexAsync<GlassDto>(glassDto);
 }