public IHttpActionResult GetClient(string roomId, int clientId) { var client = _client.Get(roomId, clientId); if (client == null) { return(BadRequest()); } var clientModel = ClientModel.Convert(client); clientModel.CanVote = Rooms.Instance.CanVote(client.RoomId); clientModel.VoteOptions = GetVoteOptions(client); return(Ok(clientModel)); }
public IHttpActionResult JoinRoom(ClientModel model) { try { var client = _client.Join(model.Name, model.RoomId); if (client == null) { return(NotFound()); } model = ClientModel.Convert(client); model.CanVote = _room.CanVote(model.RoomId); return(Ok(model)); } catch (Exception) { return(BadRequest()); } }