示例#1
0
        // adding method
        public virtual void AddMember(GymMember gymMeber)
        {
            MemberInGym member = memberCollection
                                 .Where(p => p.GymMember.GymMemberId == gymMeber.GymMemberId)
                                 .FirstOrDefault();

            if (member == null)
            {
                memberCollection.Add(
                    new MemberInGym
                {
                    GymMember = gymMeber,
                    TimeIn    = DateTime.Now.ToString("hh:mm")
                }
                    );
            }
        }
示例#2
0
 //removing method
 public virtual void RemoveMember(GymMember gymMember)
 {
     memberCollection.Remove(
         memberCollection.FirstOrDefault(p => p.GymMember.GymMemberId == gymMember.GymMemberId)
         );
 }