public async Task <Result> InviteUserByEmail(League league, string inviteEmail) { var existingInvite = await GetMatchingInvite(league, inviteEmail); if (existingInvite.HasValue) { return(Result.Failure("User is already invited to this league.")); } FantasyCriticUser inviteUser = await _userManager.FindByEmailAsync(inviteEmail); if (inviteUser != null) { bool userInLeague = await UserIsInLeague(league, inviteUser); if (userInLeague) { return(Result.Failure("User is already in league.")); } } LeagueInvite invite = new LeagueInvite(Guid.NewGuid(), league, inviteEmail); await _fantasyCriticRepo.SaveInvite(invite); return(Result.Success()); }
public LeagueInviteEntity(LeagueInvite domain) { InviteID = domain.InviteID; LeagueID = domain.League.LeagueID; EmailAddress = domain.EmailAddress; if (domain.User is not null) { UserID = domain.User.Id; } }
public LeagueInviteEntity(LeagueInvite domain) { InviteID = domain.InviteID; LeagueID = domain.League.LeagueID; EmailAddress = domain.EmailAddress; if (domain.User.HasValue) { UserID = domain.User.Value.UserID; } }
public async Task <Result> InviteUserByUserID(League league, FantasyCriticUser inviteUser) { var existingInvite = await GetMatchingInvite(league, inviteUser); if (existingInvite.HasValue) { return(Result.Failure("User is already invited to this league.")); } bool userInLeague = await UserIsInLeague(league, inviteUser); if (userInLeague) { return(Result.Failure("User is already in league.")); } LeagueInvite invite = new LeagueInvite(Guid.NewGuid(), league, inviteUser); await _fantasyCriticRepo.SaveInvite(invite); return(Result.Success()); }
public Task DeleteInvite(LeagueInvite invite) { return(_fantasyCriticRepo.DeleteInvite(invite)); }
public Task DeleteInvite(LeagueInvite leagueInvite) { throw new NotImplementedException(); }
public Task AcceptInvite(LeagueInvite leagueInvite, FantasyCriticUser user) { throw new NotImplementedException(); }
public static LeagueInviteViewModel CreateWithDisplayName(LeagueInvite invite, FantasyCriticUser user) { return(new LeagueInviteViewModel(invite.InviteID, invite.League, user.DisplayName)); }
public static LeagueInviteViewModel CreateWithEmailAddress(LeagueInvite invite) { return(new LeagueInviteViewModel(invite.InviteID, invite.League, invite.EmailAddress)); }