public IActionResult AddParticipant(int id, [FromBody] Participant participant, [FromServices] IAddParticipantCommand addParticipantCommand) { if (ModelState.IsValid) { return(Ok(addParticipantCommand.Execute(participant, id))); } else { return(BadRequest("Error")); } }
public IActionResult AddParticipant(string roomCode, [FromBody] Participant participant, [FromServices] IAddParticipantCommand addParticipantCommand) { if (ModelState.IsValid) { if (string.IsNullOrWhiteSpace(roomCode)) { throw new ArgumentNullException("The roomcode that was provided is empty."); } return(Ok(addParticipantCommand.Execute(participant, roomCode))); } else { return(BadRequest("Error")); } }