public IActionResult CreateSession([FromBody] string gameId) { string userId = _httpContextAccessor.HttpContext.User.Identity.Name; User user = _userService.Get(userId); if (user == null) { return(BadRequest("User does not exist")); } Games game = _gameservice.GetGame(gameId); if (game == null) { return(BadRequest("Game does not exist")); } var session = _sessionService.CreateSession(game, user); if (session == null) { return(BadRequest("Could not create new session")); } return(Ok(session)); }
public Session CreateSession([FromBody] SessionApplication application) { var session = _sessionsService.CreateSession(application.SessionName, application.MasterName); return(session); }