예제 #1
0
        public ServiceResponse AddWrangler(int eventId, int memberId)
        {
            var eventity            = this.GetEvent(eventId);
            var member              = this.GetMember(memberId);
            var participationRecord = new EventParticipation
            {
                MemberId = member.Id,
                EventId  = eventity.Id
            };

            Repository <EventParticipation>().Insert(participationRecord);
            SaveChanges();

            return(new ServiceResponse(ServiceResponseType.Created));
        }
예제 #2
0
        public ServiceResponse AddParticipant(int eventId, int memberId, int costumeId)
        {
            var eventity = this.GetEvent(eventId);
            var member   = this.GetMember(memberId);
            var costume  = member.Costumes.FirstOrDefault(x => x.Id == costumeId);

            if (costume == null)
            {
                throw new DbException(DbExceptionReason.CostumeNotExist, "Member does not have costume");
            }

            var participationRecord = new EventParticipation
            {
                CostumeId = costume.Id,
                MemberId  = member.Id,
                EventId   = eventity.Id
            };

            Repository <EventParticipation>().Insert(participationRecord);
            SaveChanges();

            return(new ServiceResponse(ServiceResponseType.Created));
        }