예제 #1
0
        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);
        }
예제 #2
0
 public Task <Club> GetClubById(int clubId)
 {
     return(_clubsRepository.GetClubById(clubId));
 }