CapRaffle.Domain.Implementation.DrawingRepository.NotifyParticipants C# (CSharp) 메소드

NotifyParticipants() 공개 메소드

public NotifyParticipants ( int eventId ) : bool
eventId int
리턴 bool
        public bool NotifyParticipants(int eventId)
        {
            IEmailSender emailSender = new EmailSender();
            bool emailsDeliverd = true;

            var selectedEvent = context.Events.FirstOrDefault(x => x.EventId == eventId);
            if (selectedEvent != null)
            {
                bool emailSendt = emailSender.NotifyCreator(selectedEvent);
                if (!emailSendt) emailsDeliverd = false;
            }

            foreach(Winner w in WinnersForEvent(eventId))
            {
                bool emailSendt = emailSender.NotifyWinner(w);
                if (!emailSendt) emailsDeliverd = false;
            }
            foreach (var looser in EventParticipantsForEvent(eventId))
            {
                bool emailSendt = emailSender.NotifyLooser(looser);
                if (!emailSendt) emailsDeliverd = false;
            }
            return emailsDeliverd;
        }