/* * public async Task<IActionResult> GetUserMatches() * { * var currentUser = await GetCurrentUser(); * * * var matchs = (await _matchRepository.GetUserMatches(currentUser)) * .OrderByDescending(m => m.MatchedSince) * .ToList(); * * * * * } * */ public async Task <IActionResult> CreateMatchAction(CreateMatchActionDTO createMatchActionDto) { if (!Guid.TryParse(createMatchActionDto.LikedUserGuid, out Guid likedUserGUid)) { return(BadRequest()); } var likedUser = await _userRepository.GetByGuidAsync(likedUserGUid); if (likedUser == null) { return(NotFound()); } var currentUser = await GetCurrentUser(); var newMatchAction = new MatchAction(currentUser, likedUser, createMatchActionDto.MatchActionStatus); newMatchAction = await _matchActionRepository.CreateMatchActionAsync(newMatchAction); if (await _matchActionRepository.IsFullMatchAsync(newMatchAction)) { var newMatch = new Match() { }; //TODO: Make a full match var savedMatch = await _matchRepository.CreateNewMatchAsync(newMatch); } await _matchRepository.SaveAsync(); return(Ok()); }
public void TestInit() { _userRepositoryMock = new Mock <IUserRepository>(); _matchActionRepositoryMock = new Mock <IMatchActionRepository>(); _matchRepositoryMock = new Mock <IMatchRepository>(); _validCreateMatchActionDto = new CreateMatchActionDTO() { LikedUserGuid = _validGuid, MatchActionStatus = MatchActionStatus.Liked }; }