Example #1
0
        public IEnumerable <IWeddingGuest> FetchGuests(string code, out IWeddingGuestGroup group)
        {
            var db = new TooksCmsDAL();

            var guests = db.Guest1.Where(g => g.Code == code);

            if (guests.Count() == 0)
            {
                group = null;
                return(new List <IWeddingGuest>());
            }

            if (guests.Select(g => g.GuestGroupId).Distinct().Count() > 1)
            {
                throw new IndexOutOfRangeException("Guests in select are assosiated to more than one group");
            }

            group = guests.FirstOrDefault().GuestGroup;

            var groupGuests = db.Guest1.Where(g => g.GuestGroupId == guests.FirstOrDefault().GuestGroup.GuestGroupId);

            return(guests.Concat(groupGuests).Distinct());
        }
Example #2
0
 public WeddingGuestGroup(IWeddingGuestGroup data) :
     base(data, typeof(IWeddingGuestGroup))
 {
 }