コード例 #1
0
 public async Task UpdateAsync(OtherDto otherDto)
 {
     var other = Mapper.Map<OtherDto, Other>(otherDto);
     await _otherRepository.UpdateAsync(other);
     var result = await _otherRepository.GetSingleAsync(otherDto.Id);
     var mappedResult = Mapper.Map<Other, OtherDto>(result);
     await _otherElasticsearch.UpdateAsync(mappedResult);
 }
コード例 #2
0
 //Not async
 public OtherDto Add(OtherDto otherDto)
 {
     var other = Mapper.Map<OtherDto, Other>(otherDto);
      _otherRepository.Add(other);
     var result = _otherRepository.GetSingle(other.OtherId);
     var mappedResult = Mapper.Map<Other, OtherDto>(result);
     _otherElasticsearch.Update(mappedResult);
     return mappedResult;
 }
コード例 #3
0
        public async Task<IHttpActionResult> PutOther(int id, OtherDto otherDto)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != otherDto.Id)
            {
                return BadRequest();
            }
            await _otherService.UpdateAsync(otherDto);
            return StatusCode(HttpStatusCode.NoContent);
        }
コード例 #4
0
 public void Update(OtherDto otherDto)
 {
     // Adds an analayzer to the name property in FermentableDto object.
      _client.Map<OtherDto>(d => d.Properties(p => p.String(s => s.Name(n => n.Name).Analyzer("autocomplete"))));
     _client.Index<OtherDto>(otherDto);
 }
コード例 #5
0
 public async Task<IIndexResponse> UpdateAsync(OtherDto otherDto)
 {
     // Adds an analayzer to the name property in FermentableDto object.
     await _client.MapAsync<OtherDto>(d => d.Properties(p => p.String(s => s.Name(n => n.Name).Analyzer("autocomplete"))));
     return await _client.IndexAsync<OtherDto>(otherDto);
 }
コード例 #6
0
 public async Task<IHttpActionResult> PostOther(OtherDto otherDto)
 {
     if (!ModelState.IsValid)
     {
         return BadRequest(ModelState);
     }
     var result = await _otherService.AddAsync(otherDto);
     return CreatedAtRoute("DefaultApi", new { controller = "others", }, result);
 }