public async Task PostBeerStyleReturns201CreatedWithObject()
 {
     var beerStyle = new BeerStyleDto() { Name = "Lager" };
     var response = await _controller.PostBeerStyle(beerStyle) as CreatedAtRouteNegotiatedContentResult<BeerStyleCompleteDto>;
     Assert.IsInstanceOf<CreatedAtRouteNegotiatedContentResult<BeerStyleCompleteDto>>(response);
     Assert.True(response.Content.BeerStyles.Any());
 }
 public async Task UpdateAsync(BeerStyleDto beerStyleDto)
 {
     var beerStyle = Mapper.Map<BeerStyleDto, BeerStyle>(beerStyleDto);
     await _beerStyleRepository.UpdateAsync(beerStyle);
     var result = await _beerStyleRepository.GetSingleAsync(beerStyleDto.Id, "SubStyles", "SuperStyle");
     var mappedResult = Mapper.Map<BeerStyle, BeerStyleDto>(result);
     await _beerStyleElasticsearch.UpdateAsync(mappedResult);
 }
        public async Task<BeerStyleDto> AddAsync(BeerStyleDto otherDto)
        {
            var beerStyle = Mapper.Map<BeerStyleDto, BeerStyle>(otherDto);
            await _beerStyleRepository.AddAsync(beerStyle);
            var result = await _beerStyleRepository.GetSingleAsync(beerStyle.BeerStyleId, "SubStyles", "SuperStyle");
            var mappedResult = Mapper.Map<BeerStyle, BeerStyleDto>(result);
            await _beerStyleElasticsearch.UpdateAsync(mappedResult);
            return mappedResult;

        }
 public async Task<IHttpActionResult> PutBeerStyle(int id, BeerStyleDto beerstyle)
 {
     if (!ModelState.IsValid)
     {
         return BadRequest(ModelState);
     }
     if (id != beerstyle.Id)
     {
         return BadRequest();
     }
     await _beerStyleService.UpdateAsync(beerstyle);
     return StatusCode(HttpStatusCode.NoContent);
 }
 public async Task UpdateAsync(BeerStyleDto beerStyleDto)
 {
     await _client.MapAsync<BeerStyleDto>(d => d.Properties(p => p.String(s => s.Name(n => n.Name).Analyzer("autocomplete"))));
     var index = await _client.IndexAsync<BeerStyleDto>(beerStyleDto);
 }
 public async Task<IHttpActionResult> PostBeerStyle(BeerStyleDto beerStylesDto)
 {
     if (!ModelState.IsValid)
     {
         return BadRequest(ModelState);
     }
     var result = await _beerStyleService.AddAsync(beerStylesDto);
     return CreatedAtRoute("DefaultApi", new { controller = "beerstyles" }, result);
 }