예제 #1
0
        public Peanut Create(UserGroup userGroup, PeanutDto peanutDto, IList <RequirementDto> requirements,
                             IDictionary <UserGroupMembership, PeanutParticipationDto> initialParticipators, User user)
        {
            foreach (UserGroupMembership groupMembership in initialParticipators.Keys)
            {
                if (!userGroup.Equals(groupMembership.UserGroup))
                {
                    throw new InvalidOperationException("Ein Peanut kann nur für Mitglieder der selben Gruppe erstellt werden.");
                }
            }
            Peanut peanut = new Peanut(userGroup, peanutDto, requirements, initialParticipators, new EntityCreatedDto(user, DateTime.Now));

            PeanutDao.Save(peanut);
            return(peanut);
        }