public async Task <IActionResult> CreateMasterGame([FromBody] CreateMasterGameRequest viewModel) { EligibilityLevel eligibilityLevel = await _fantasyCriticService.GetEligibilityLevel(viewModel.EligibilityLevel); MasterGame masterGame = viewModel.ToDomain(eligibilityLevel); await _fantasyCriticService.CreateMasterGame(masterGame); return(Ok()); }
public async Task <IActionResult> CreateLeague([FromBody] CreateLeagueRequest request) { var currentUser = await _userManager.FindByNameAsync(User.Identity.Name); if (currentUser == null) { return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest()); } EligibilityLevel eligibilityLevel = await _fantasyCriticService.GetEligibilityLevel(request.MaximumEligibilityLevel); LeagueCreationParameters domainRequest = request.ToDomain(currentUser, eligibilityLevel); await _fantasyCriticService.CreateLeague(domainRequest); return(Ok()); }