public void Execute(CargoInsertDto dto) { var registro = _mapper.Map <CargoInsertDto, Cargo>(dto); _context.Cargos.Add(registro); _context.Save(); }
public ActionResult CreateCargo(CargoInsertDto dto) { string token = Microsoft.AspNetCore.Authentication.AuthenticationHttpContextExtensions.GetTokenAsync(HttpContext, "access_token").Result; var response = HttpRequestFactory.Post(_configuration["Endpoints:Cargos"], dto, token).Result; _logger.LogInformation(string.Format("CreateCargo: StatusCode:{0} , RequestMessage:{1} ", response.StatusCode, response.RequestMessage)); return(convertMessage(response, response.ContentAsType <CargoInsertDto>())); }
public ActionResult Post(CargoInsertDto dto) { _insertCargo.Execute(dto); return(Ok()); }