public async Task CreateEvent(ClubEventCreateRequest clubEventCreateRequest) { Club club = await _clubsRepository.GetClubById(clubEventCreateRequest.ClubId); if (club == null) { return; } ClubEvent clubEvent = new ClubEvent { Club = club, Title = clubEventCreateRequest.Title, Description = clubEventCreateRequest.Description, EventType = clubEventCreateRequest.EventType, StartTime = clubEventCreateRequest.StartTime, Longtitude = clubEventCreateRequest.Coordinates.Longtitute, Latitude = clubEventCreateRequest.Coordinates.Latitude }; if (clubEventCreateRequest.IncludePlayerStatuses == PlayerStatus.All) { foreach (var member in club.Members) { clubEvent.InvitedMembers.Add(new ClubEventMember { ClubEvent = clubEvent, Member = member }); } } else { // clubEvent.InvitedMembers.Where(im => im IN IncludePlayerStatuses) = club.Members, TODO Implement individual events } _clubEventsRepository.AddEvent(clubEvent); }
public Task <Club> GetClubById(int clubId) { return(_clubsRepository.GetClubById(clubId)); }