コード例 #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);
 }
コード例 #2
0
        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);
        }
コード例 #3
0
 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);
 }
コード例 #4
0
 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);
 }