public ActionResult Put(PerfilUpdateDto dto) { _updatePerfil.Execute(dto); _logger.LogInformation(string.Format("Perfil Id:{0} Modificado por Usuario:{1} ", dto.Id, dto.Identity)); return(Ok(dto)); }
public ActionResult UpdatePerfil(PerfilUpdateDto dto) { string token = Microsoft.AspNetCore.Authentication.AuthenticationHttpContextExtensions.GetTokenAsync(HttpContext, "access_token").Result; var response = HttpRequestFactory.Put(_configuration["Endpoints:Perfiles"], dto, token).Result; _logger.LogInformation(string.Format("UpdatePerfil: StatusCode:{0} , RequestMessage:{1} ", response.StatusCode, response.RequestMessage)); return(convertMessage(response, response.ContentAsType <PerfilUpdateDto>())); }
public void Execute(PerfilUpdateDto dto) { var registro = _context.Perfiles.SingleOrDefault(x => x.Id == dto.Id); if (registro == null) { throw new EntityNotFoundException("Perfil", dto.Id.ToString()); } _mapper.Map(dto, registro); _context.Save(); }