Exemplo n.º 1
0
 public async Task UpdateAsync(SupplierDto supplierDto)
 {
     var supplier = Mapper.Map<SupplierDto, Supplier>(supplierDto);
     await _supplierRepository.UpdateAsync(supplier);
     var result = await _supplierRepository.GetSingleAsync(supplier.SupplierId, "Origin");
     var mapperResult = Mapper.Map<Supplier, SupplierDto>(result);
     await _supplierElasticsearch.UpdateAsync(mapperResult);
 }
        public async Task<IHttpActionResult> PutSupplier(int id, SupplierDto supplierDto)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != supplierDto.Id)
            {
                return BadRequest();
            }
            await _supplierService.UpdateAsync(supplierDto);
            return StatusCode(HttpStatusCode.NoContent);
        }
 public async Task UpdateAsync(SupplierDto supplierDto)
 {
     // Adds an analayzer to the name property in FermentableDto object.
     await _client.MapAsync<SupplierDto>(d => d.Properties(p => p.String(s => s.Name(n => n.Name).Analyzer("autocomplete"))));
     var index = await _client.IndexAsync<SupplierDto>(supplierDto);
 }
 public async Task<IHttpActionResult> PostSupplier(SupplierDto supplierDto)
 {
     if (!ModelState.IsValid)
     {
         return BadRequest(ModelState);
     }
     var result = await _supplierService.AddAsync(supplierDto);
     return CreatedAtRoute("DefaultApi", new {controller = "others"}, result);
 }