Exemplo n.º 1
0
        public void AddBoat(Member addToMember, Boat boat)
        {
            var member = (from mem in members
                          where mem.UniqueId == addToMember.UniqueId
                          select mem).FirstOrDefault();
            boat.Id = GenerateUniqueBoatId(addToMember);

            member.Boats.Add(boat);
            db.Save((List<Member>)members);
        }
Exemplo n.º 2
0
        public void DeleteBoat(Member deleteFromMember, Boat toBeDeleted)
        {
            var delBoat = (from boat in deleteFromMember.Boats
                        where boat.Id == toBeDeleted.Id
                        select boat).FirstOrDefault();

            deleteFromMember.Boats.Remove(delBoat);
            //Rearange id starting from 1 and increasing by 1
            OrderBoatId(deleteFromMember);
            db.Save((List<Member>)members);
        }
Exemplo n.º 3
0
        public void UpdateBoat(Member updateFromMember, Boat toBeUpdated, BoatType type, float length)
        {
            var updateBoat = (from boat in updateFromMember.Boats
                              where boat.Id == toBeUpdated.Id
                              select boat).FirstOrDefault();

            //updateFromMember.Boats.Remove(updateBoat);

            DeleteBoat(updateFromMember, toBeUpdated);
            toBeUpdated.BoatType = type;
            toBeUpdated.Length = length;
            AddBoat(updateFromMember, toBeUpdated);

            //db.Save((List<Member>)members);
        }