public async Task <IActionResult> Put(int id, [FromBody] CreateUpdateServerDto server, CancellationToken cancellationToken) { var command = new UpdateServerCommand { Id = id, Server = server }; await Mediator.Send(command, cancellationToken); return(NoContent()); }
public async Task <int> CreateNew(CreateUpdateServerDto server) { var result = await _http.PostAsJsonAsync($"{_api.Url}/servers", server); await result.EnsureSuccess(); var response = await result.Content.ReadFromJsonAsync <IdResponse>(); return(response.Id); }
public async Task <IActionResult> Post([FromBody] CreateUpdateServerDto server, CancellationToken cancellationToken) { var command = new CreateServerCommand { Server = server }; var id = await Mediator.Send(command, cancellationToken); return(new JsonResult(new { id }) { StatusCode = 201 }); }
public async Task Update(int id, CreateUpdateServerDto server) { var result = await _http.PutAsJsonAsync($"{_api.Url}/servers/{id}", server); await result.EnsureSuccess(); }