public async Task <IActionResult> CreateGasStation(GasStation gs) { var request = new CreateGasStationRequest() { CNPJ = gs.CNPJ, Name = gs.Name, CEP = gs.CEP, City = gs.City, Neighborhood = gs.Neighborhood, Number = gs.Number, Street = gs.Street, UF = gs.UF }; var success = await _movtechAPIService.CreateGasStation(request); var viewModel = new RefuelIndexViewModel() { Postos = await GetPostos() }; ViewBag.PostoCriado = "true"; return(View("Index", viewModel)); }
public async Task <bool> CreateGasStation(CreateGasStationRequest request) { try { HttpResponseMessage _message = await _client.PostAsync("api/v1/Refuels/gasStations", new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json")); return(_message.IsSuccessStatusCode); } catch (Exception ex) { throw; } }