Пример #1
0
        public Apartment CreateNewApartment(CreateNewApartmentInput input)
        {
            var rooms = new List <Room>();

            foreach (var inputRoom in input.Rooms)
            {
                // We create a new room
                var newRoom = _roomService.CreateNewRoom(new CreateNewRoomInput
                {
                    Room = inputRoom
                });

                rooms.Add(newRoom); // We add the new room to our apartment to be created
            }

            var apartment = Apartment.Create(input.Name,
                                             input.Street,
                                             input.ZipCode,
                                             input.City,
                                             rooms);

            _apartmentRepository.Insert(apartment);

            return(apartment);
        }