Пример #1
0
        public static Room AddTherapyPlace(this Room room, TherapyPlace newTherapyPlace)
        {
            var newTherapyPlaceList = room.TherapyPlaces.Append(newTherapyPlace);

            return(new Room(room.Id,
                            room.Name,
                            newTherapyPlaceList,
                            room.DisplayedColor));
        }
Пример #2
0
        public static Room UpdateTherapyPlace(this Room room, TherapyPlace updatedTherapyPlace)
        {
            var oldTherapyPlaceList = room.TherapyPlaces.ToList();
            var newTherapyPlaceList = new List <TherapyPlace>();

            foreach (var therapyPlace in oldTherapyPlaceList)
            {
                if (therapyPlace.Id != updatedTherapyPlace.Id)
                {
                    newTherapyPlaceList.Add(therapyPlace);
                }
                else
                {
                    newTherapyPlaceList.Add(updatedTherapyPlace);
                }
            }

            return(new Room(room.Id,
                            room.Name,
                            newTherapyPlaceList,
                            room.DisplayedColor));
        }
Пример #3
0
 public static TherapyPlace SetNewType(this TherapyPlace therapyPlace, Guid newTherapyPlaceTypeId)
 {
     return(new TherapyPlace(therapyPlace.Id,
                             newTherapyPlaceTypeId,
                             therapyPlace.Name));
 }
Пример #4
0
 public static TherapyPlace SetNewName(this TherapyPlace therapyPlace, string newName)
 {
     return(new TherapyPlace(therapyPlace.Id,
                             therapyPlace.TypeId,
                             newName));
 }