Esempio n. 1
0
        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>()));
        }
Esempio n. 2
0
        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();
        }
Esempio n. 3
0
 public ActionResult Put(CargoUpdateDto dto)
 {
     _updateCargo.Execute(dto);
     return(Ok());
 }