public ActionResult UpdateCargo(CargoUpdateDto dto) { string token = Microsoft.AspNetCore.Authentication.AuthenticationHttpContextExtensions.GetTokenAsync(HttpContext, "access_token").Result; var response = HttpRequestFactory.Put(_configuration["Endpoints:Cargos"], dto, token).Result; _logger.LogInformation(string.Format("UpdateCargo: StatusCode:{0} , RequestMessage:{1} ", response.StatusCode, response.RequestMessage)); return(convertMessage(response, response.ContentAsType <CargoUpdateDto>())); }
public void Execute(CargoUpdateDto dto) { var cargo = _context.Cargos.SingleOrDefault(x => x.Id == dto.Id); if (cargo == null) { throw new EntityNotFoundException("Cargo", dto.Id.ToString()); } _mapper.Map(dto, cargo); _context.Save(); }
public ActionResult Put(CargoUpdateDto dto) { _updateCargo.Execute(dto); return(Ok()); }