public async Task StartAsync() { Match = MatchFactory.Create(); OnMatchStarting(); await Match.StartAsync(); OnMatchFinished(); }
public async Task <IHttpActionResult> CreateMatch(int warId) { if (!await IsValidWarId(warId)) { return(NotFound()); } if (await _contestantRepository.GetCount(warId) < 2) { return(Conflict()); } var user = _mapper.Map <ClaimsPrincipal, War.Users.User>(User as ClaimsPrincipal); await _userRepository.Upsert(user); var match = await _matchFactory.Create(warId, user.Id); var matchModel = _mapper.Map <MatchWithContestants, Models.Match>(match); return(Created("", matchModel)); }