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)); }
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)); }