Exemplo n.º 1
0
        public dynamic searchUniqueBoat(int memberID, int boatID)
        {
            BoatModel boatFromDb = new BoatModel();

            foreach (var member in data)
            {
                if (member.ID == memberID)
                {
                    foreach (var boat in member.boatList)
                    {
                        if (boat.ID == boatID)
                        {
                            boatFromDb = boat;
                        }
                    }
                }
            }
            return(boatFromDb);
        }
Exemplo n.º 2
0
        public void deleteBoat(int memberID, int boatID)
        {
            MemberModel memberFromDb = new MemberModel();
            BoatModel   boatToRemove = new BoatModel();

            foreach (var member in data)
            {
                if (member.ID == memberID)
                {
                    memberFromDb = member;
                    foreach (var boat in member.boatList)
                    {
                        if (boat.ID == boatID)
                        {
                            boatToRemove = boat;
                        }
                    }
                    member.boatList.Remove(boatToRemove);
                }
            }
            writeToDatabase(data);
        }