public async Task <ActionResult> Create(ReserveRoomCommand reserveRoom) { var ok = false; using (var httpClient = new HttpClient()) { string json = JsonConvert.SerializeObject(reserveRoom); HttpContent content = new StringContent(json, System.Text.Encoding.UTF8, "application/json"); using var response = await httpClient.PostAsync(_configuration.GetSection ("apiUrl").Value + "/reservations/Add", content); var apiResponse = await response.Content.ReadAsStringAsync(); Console.WriteLine("res " + apiResponse); if (response.StatusCode == HttpStatusCode.OK) { ok = true; } } return(RedirectToAction("")); }
public async Task <IActionResult> Add(ReserveRoomCommand command) { int id = await Mediator.Send(command); return(Ok(id)); }