Beispiel #1
0
        public void CityService_GetByIdAsync_ReturnsCity()
        {
            //Arrange
            _city = new City
            {
                Id      = 1,
                Name    = "sigh",
                Cinemas = new List <Data.Cinema>()
            };
            Data.Cinema cinema2 = new Data.Cinema
            {
                Id     = 1,
                CityId = 1,
                Name   = "prolecni bioskop"
            };
            List <Data.Cinema> cinemas = new List <Data.Cinema>();

            cinemas.Add(cinema2);
            _city.Cinemas = cinemas;
            _cityRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).ReturnsAsync(_city);

            //Act
            var resultAction = _cityService.GetByIdAsync(_city.Id).ConfigureAwait(false).GetAwaiter().GetResult();

            //Assert
            Assert.IsNotNull(resultAction);
            Assert.AreEqual(_city.Id, resultAction.Id);
            Assert.IsInstanceOfType(resultAction, typeof(CityDomainModel));
        }
        public void AuditoriumsService_CreateAuditorium_ReturnCreateAuditoriumResultModel_InvalidCinemaId()
        {
            //Arrange
            CreateAuditoriumResultModel expectedResultModel = new CreateAuditoriumResultModel()
            {
                ErrorMessage = "Cannot create new auditorium, auditorium with given cinemaId does not exist.",
                IsSuccessful = false
            };
            AuditoriumDomainModel auditoriumDomainModel = _auditoriumDomainModel;
            var numberOfSeatsPerRow = 2;
            var numberOfRows        = 2;

            Data.Cinema        cinema       = null;
            Task <Data.Cinema> responseTask = Task.FromResult(cinema);

            _mockCinemasRepository = new Mock <ICinemasRepository>();
            _mockCinemasRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).Returns(responseTask);
            AuditoriumService auditoriumController = new AuditoriumService(_mockAuditoriumsRepository.Object, _mockCinemasRepository.Object, _mockSeatsRepository.Object, _mockProjectionRepository.Object, _mockTicketService.Object);
            //Act
            var resultAction = auditoriumController.CreateAuditorium(_auditoriumDomainModel, numberOfRows, numberOfSeatsPerRow).ConfigureAwait(false).GetAwaiter().GetResult();

            //Assert
            Assert.IsNotNull(resultAction);
            Assert.AreEqual(expectedResultModel.ErrorMessage, resultAction.ErrorMessage);
            Assert.IsFalse(resultAction.IsSuccessful);
            Assert.IsInstanceOfType(resultAction, typeof(CreateAuditoriumResultModel));
        }
        public void AuditoriumsService_CreateAuditorium_ReturnCreateAuditoriumResultModel_AuditoriumWithSameNameExists()
        {
            //Arrange
            CreateAuditoriumResultModel expectedResultModel = new CreateAuditoriumResultModel()
            {
                ErrorMessage = "Cannot create new auditorium, auditorium with same name already exist.",
                IsSuccessful = false
            };
            IEnumerable <Auditorium> auditoriums           = _listOFAuditoriums;
            AuditoriumDomainModel    auditoriumDomainModel = _auditoriumDomainModel;
            var numberOfSeatsPerRow = 2;
            var numberOfRows        = 2;

            Data.Cinema        cinema = _cinema;
            Task <Data.Cinema> responseTaskCinemasRepository = Task.FromResult(cinema);

            _mockCinemasRepository = new Mock <ICinemasRepository>();
            _mockCinemasRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).Returns(responseTaskCinemasRepository);
            _mockAuditoriumsRepository = new Mock <IAuditoriumsRepository>();
            Task <IEnumerable <Auditorium> > responseTaskAuditoriumsRepository = Task.FromResult(auditoriums);

            _mockAuditoriumsRepository.Setup(x => x.GetByAuditName(auditoriumDomainModel.Name, cinema.Id)).Returns(responseTaskAuditoriumsRepository);
            AuditoriumService auditoriumController = new AuditoriumService(_mockAuditoriumsRepository.Object, _mockCinemasRepository.Object, _mockSeatsRepository.Object, _mockProjectionRepository.Object, _mockTicketService.Object);
            //Act
            var resultAction = auditoriumController.CreateAuditorium(_auditoriumDomainModel, numberOfRows, numberOfSeatsPerRow).ConfigureAwait(false).GetAwaiter().GetResult();

            //Assert
            Assert.IsNotNull(resultAction);
            Assert.AreEqual(expectedResultModel.ErrorMessage, resultAction.ErrorMessage);
            Assert.IsFalse(resultAction.IsSuccessful);
            Assert.IsInstanceOfType(resultAction, typeof(CreateAuditoriumResultModel));
        }
Beispiel #4
0
        public void CinemaService_GetAllCinemasAsync_ReturnsListOfCinemas()
        {
            //Arrange
            var expectedCount = 2;

            Data.Cinema cinema2 = new Data.Cinema
            {
                Id     = 22,
                CityId = 1,
                Name   = "Los bioskop"
            };
            CinemaDomainModel cinemaDomainModel2 = new CinemaDomainModel
            {
                Id     = cinema2.Id,
                CityId = cinema2.CityId,
                Name   = cinema2.Name
            };
            List <Data.Cinema> cinemas = new List <Data.Cinema>();

            cinemas.Add(_cinema);
            cinemas.Add(cinema2);
            _mockCinemaRepository.Setup(x => x.GetAll()).ReturnsAsync(cinemas);

            //Act
            var resultAction = cinemaService.GetAllAsync().ConfigureAwait(false).GetAwaiter().GetResult();
            var result       = resultAction.ToList();

            //Assert
            Assert.IsNotNull(resultAction);
            Assert.AreEqual(expectedCount, result.Count);
            Assert.AreEqual(_cinema.Name, result[0].Name);
            Assert.IsInstanceOfType(resultAction, typeof(IEnumerable <CinemaDomainModel>));
        }
        public void AuditoriumsService_CreateAuditorium_ReturnCreateAuditoriumResultModel_Successful()
        {
            IEnumerable <Auditorium> auditoriums           = _listOFAuditoriums;
            AuditoriumDomainModel    auditoriumDomainModel = _auditoriumDomainModel;
            Auditorium auditorium          = _auditorium;
            Auditorium newAuditorium       = _newAuditorium;
            var        numberOfSeatsPerRow = 1;
            var        numberOfRows        = 1;

            Data.Cinema        cinema = _cinema;
            Task <Data.Cinema> responseTaskCinemasRepository = Task.FromResult(cinema);

            _mockCinemasRepository = new Mock <ICinemasRepository>();
            _mockCinemasRepository.Setup(x => x.GetByIdAsync(It.IsAny <int>())).Returns(responseTaskCinemasRepository);
            _mockAuditoriumsRepository = new Mock <IAuditoriumsRepository>();
            Task <IEnumerable <Auditorium> > responseTaskAuditoriumsRepository = Task.FromResult(auditoriums);

            _mockAuditoriumsRepository.Setup(x => x.GetByAuditName(auditoriumDomainModel.Name, cinema.Id)).Returns(responseTaskAuditoriumsRepository);
            _mockAuditoriumsRepository = new Mock <IAuditoriumsRepository>();
            _mockAuditoriumsRepository.Setup(x => x.Insert(It.IsAny <Auditorium>())).Returns(newAuditorium);

            AuditoriumService auditoriumController = new AuditoriumService(_mockAuditoriumsRepository.Object, _mockCinemasRepository.Object, _mockSeatsRepository.Object, _mockProjectionRepository.Object, _mockTicketService.Object);
            //Act
            var resultAction = auditoriumController.CreateAuditorium(_auditoriumDomainModel, numberOfRows, numberOfSeatsPerRow).ConfigureAwait(false).GetAwaiter().GetResult();

            //Assert
            Assert.IsNotNull(resultAction);
            Assert.IsNull(resultAction.ErrorMessage);
            Assert.IsTrue(resultAction.IsSuccessful);
            Assert.IsInstanceOfType(resultAction, typeof(CreateAuditoriumResultModel));
            Assert.AreEqual(1, resultAction.Auditorium.Id);
        }
        public Data.Cinema Delete(object id)
        {
            Data.Cinema existing = _cinemaContext.Cinemas.Find(id);
            var         result   = _cinemaContext.Cinemas.Remove(existing);

            return(result.Entity);
        }
        public void TestInitialize()
        {
            _auditorium = new Auditorium
            {
                Id        = 1,
                CinemaId  = 1,
                AuditName = "Novi auditorium",
            };

            _auditoriumDomainModel = new AuditoriumDomainModel
            {
                Id       = _auditorium.Id,
                CinemaId = _auditorium.CinemaId,
                Name     = _auditorium.AuditName
            };

            _cinema = new Data.Cinema
            {
                Id     = 1,
                CityId = 1,
                Name   = "test bioskop 1"
            };

            _cinemaDomainModel = new CinemaDomainModel
            {
                Id     = _cinema.Id,
                CityId = _cinema.CityId,
                Name   = _cinema.Name
            };

            _mockAuditoriumRepository = new Mock <IAuditoriumsRepository>();
            _mockCinemaRepository     = new Mock <ICinemasRepository>();
            _auditoriumService        = new AuditoriumService(_mockAuditoriumRepository.Object, _mockCinemaRepository.Object);
        }
Beispiel #8
0
        public async Task <CreateCinemaResultModel> AddCinema(CinemaDomainModel newCinema)
        {
            Data.Cinema cinemaToCreate = new Data.Cinema()
            {
                Name = newCinema.Name
            };

            var data = _cinemasRepository.Insert(cinemaToCreate);

            if (data == null)
            {
                return(new CreateCinemaResultModel
                {
                    IsSuccessful = false,
                    ErrorMessage = Messages.CINEMA_CREATION_ERROR
                });
            }

            _cinemasRepository.Save();

            CreateCinemaResultModel createCinemaResultModel = new CreateCinemaResultModel()
            {
                Cinema = new CinemaDomainModel
                {
                    Id   = data.Id,
                    Name = data.Name
                },
                IsSuccessful = true,
                ErrorMessage = null
            };

            return(createCinemaResultModel);
        }
        public Data.Cinema Update(Data.Cinema obj)
        {
            var updatedEntry = _cinemaContext.Cinemas.Attach(obj);

            _cinemaContext.Entry(obj).State = EntityState.Modified;

            return(updatedEntry.Entity);
        }
Beispiel #10
0
        public async Task <CreateCinemaResultModel> AddCinema(CinemaDomainModel newCinema)
        {
            var cinema = await _cinemasRepository.GetByCinemaName(newCinema.Name);

            var sameCinemaName = cinema.ToList();

            if (sameCinemaName != null && sameCinemaName.Count > 0)
            {
                return(new CreateCinemaResultModel
                {
                    IsSuccessful = false,
                    ErrorMessage = Messages.CINEMA_SAME_NAME
                });
            }

            Data.Cinema cinemaToCreate = new Data.Cinema()
            {
                Name = newCinema.Name
            };

            var data = _cinemasRepository.Insert(cinemaToCreate);

            if (data == null)
            {
                return(new CreateCinemaResultModel
                {
                    IsSuccessful = false,
                    ErrorMessage = Messages.CINEMA_CREATION_ERROR
                });
            }

            _cinemasRepository.Save();

            CinemaDomainModel domainModel = new CinemaDomainModel()
            {
                Id   = data.Id,
                Name = data.Name
            };

            CreateCinemaResultModel cinemaResultModel = new CreateCinemaResultModel()
            {
                ErrorMessage = null,
                IsSuccessful = true,
                Cinema       = domainModel
            };

            return(cinemaResultModel);
        }
        public void TestInitialize()
        {
            _auditorium = new Auditorium()
            {
                Id       = 1,
                CinemaId = 1,
                Name     = "AuditoriumName",
                Seats    = new List <Seat>()
            };
            _auditoriumDomainModel = new AuditoriumDomainModel()
            {
                Id       = 1,
                Name     = "AuditoriumName",
                CinemaId = 1
            };
            _cinema = new Data.Cinema()
            {
                Name = "CinemaName",
                Id   = 1
            };
            _newAuditorium = new Auditorium();
            _newAuditorium = _auditorium;
            _newAuditorium.Seats.Add(new Seat()
            {
                Number       = 1,
                Row          = 1,
                AuditoriumId = 1
            });
            _projection = new Projection()
            {
                AuditoriumId = 1,
                DateTime     = DateTime.Now.AddDays(1),
                Id           = Guid.NewGuid(),
                MovieId      = Guid.NewGuid()
            };
            _listOfProjections = new List <Projection>();
            _listOfProjections.Add(_projection);
            _listOFAuditoriums = new List <Auditorium>();
            _listOFAuditoriums.Add(_auditorium);

            _mockAuditoriumsRepository = new Mock <IAuditoriumsRepository>();
            _mockCinemasRepository     = new Mock <ICinemasRepository>();
            _mockSeatsRepository       = new Mock <ISeatsRepository>();
            _mockProjectionRepository  = new Mock <IProjectionsRepository>();
            _mockTicketService         = new Mock <ITicketService>();
        }
Beispiel #12
0
        public void CityService_GetAllAsync_ReturnsListOfCities()
        {
            //Arrange
            var  expectedCount = 2;
            var  cinemaCount   = 1;
            City city2         = new City
            {
                Id      = 2,
                Name    = "Rome",
                Cinemas = new List <Data.Cinema>()
            };

            Data.Cinema cinema2 = new Data.Cinema
            {
                Id     = 2,
                CityId = 2,
                Name   = "Smekerski bioskop"
            };

            List <Data.Cinema> cinemas = new List <Data.Cinema>();

            cinemas.Add(cinema2);
            city2.Cinemas = cinemas;
            List <City> cities = new List <City>();

            cities.Add(city2);
            cities.Add(city2);
            _cityRepository.Setup(x => x.GetAll()).ReturnsAsync(cities);

            //Act
            var resultAction = _cityService.GetAllAsync().ConfigureAwait(false).GetAwaiter().GetResult();
            var result       = resultAction.ToList();

            //Assert
            Assert.IsNotNull(resultAction);
            Assert.AreEqual(expectedCount, result.Count);
            Assert.AreEqual(city2.Id, result[0].Id);
            Assert.IsInstanceOfType(result[0], typeof(CityDomainModel));
            Assert.AreEqual(cinemaCount, result[0].CinemasList.Count);
        }
Beispiel #13
0
        public void TestInitialize()
        {
            _city = new City
            {
                Id      = 1,
                Name    = "Miami",
                Cinemas = new List <Data.Cinema>()
            };
            _cinema = new Data.Cinema
            {
                Id     = 3,
                CityId = 1,
                Name   = "Veoma los bioskop"
            };
            List <Data.Cinema> cinemas = new List <Data.Cinema>();

            cinemas.Add(_cinema);
            _city.Cinemas = cinemas;

            _cityRepository = new Mock <ICitiesRepository>();
            _cityService    = new CityService(_cityRepository.Object);
        }
Beispiel #14
0
        public void TestInitialize()
        {
            _cinema = new Data.Cinema
            {
                Id     = 11,
                CityId = 1,
                Name   = "Smekerski bioskop"
            };

            _cinemaDomainModel = new CinemaDomainModel
            {
                Id     = _cinema.Id,
                CityId = _cinema.CityId,
                Name   = _cinema.Name
            };

            _mockCinemaRepository     = new Mock <ICinemasRepository>();
            _mockAuditoriumRepository = new Mock <IAuditoriumsRepository>();
            _mockSeatRepository       = new Mock <ISeatsRepository>();
            _mockCityRepository       = new Mock <ICitiesRepository>();

            cinemaService = new CinemaService(_mockCinemaRepository.Object, _mockAuditoriumRepository.Object, _mockSeatRepository.Object, _mockCityRepository.Object);
        }
        public void TestInitialize()
        {
            _cinema = new Data.Cinema
            {
                Id          = 1,
                Name        = "CinemaName",
                Auditoriums = new List <Auditorium>()
            };
            _newCinema = new CinemaDomainModel
            {
                Id   = 1,
                Name = "CinemaName"
            };
            _listOfCinemas = new List <Data.Cinema>();
            _listOfCinemas.Add(_cinema);

            _mockCinemasRepository     = new Mock <ICinemasRepository>();
            _mockAuditoriumService     = new Mock <IAuditoriumService>();
            _mockAuditoriumsRepository = new Mock <IAuditoriumsRepository>();
            _mockProjectionsRepository = new Mock <IProjectionsRepository>();
            _mockSeatsRepository       = new Mock <ISeatsRepository>();
            _mockTicketService         = new Mock <ITicketService>();
        }
        public void CinemaService_AddCinema_HappyFlow()
        {
            //Arrange
            Data.Cinema       cinema    = _cinema;
            CinemaDomainModel newCinema = _newCinema;

            _mockCinemasRepository.Setup(x => x.Insert(It.IsAny <Data.Cinema>())).Returns(cinema);
            CinemaService cinemaController = new CinemaService(_mockCinemasRepository.Object,
                                                               _mockAuditoriumService.Object,
                                                               _mockAuditoriumsRepository.Object,
                                                               _mockProjectionsRepository.Object,
                                                               _mockTicketService.Object,
                                                               _mockSeatsRepository.Object);
            //Act
            var resultAction = cinemaController.AddCinema(newCinema).ConfigureAwait(false)
                               .GetAwaiter().GetResult();

            //Assert
            Assert.IsNotNull(resultAction);
            Assert.IsTrue(resultAction.IsSuccessful);
            Assert.IsNull(resultAction.ErrorMessage);
            Assert.IsNotNull(resultAction.Cinema);
            Assert.AreEqual(_newCinema.Id, resultAction.Cinema.Id);
        }
Beispiel #17
0
        public async Task <CinemaDomainModel> UpdateCinema(CinemaDomainModel updateCinema)
        {
            Data.Cinema cinema = new Data.Cinema()
            {
                Id   = updateCinema.Id,
                Name = updateCinema.Name
            };

            var data = _cinemasRepository.Update(cinema);

            if (data == null)
            {
                return(null);
            }
            _cinemasRepository.Save();

            CinemaDomainModel domainModel = new CinemaDomainModel()
            {
                Id   = data.Id,
                Name = data.Name
            };

            return(domainModel);
        }
        public Data.Cinema Insert(Data.Cinema obj)
        {
            var data = _cinemaContext.Cinemas.Add(obj).Entity;

            return(data);
        }
 public Data.Cinema Insert(Data.Cinema obj)
 {
     return(_cinemaContext.Cinemas.Add(obj).Entity);
 }
Beispiel #20
0
        // CreateAuditorium(AuditoriumDomainModel domainModel, int numberOfRows, int numberOfSeats)
        public async Task <CreateCinemaResultModel> AddCinemaWithAuditorium(CreateCinemaWithAuditoriumModel newCinemaWithAuditorium)
        {
            var cinema = await _cinemasRepository.GetByCinemaName(newCinemaWithAuditorium.CinemaName);

            var sameCinemaName = cinema.ToList();

            if (sameCinemaName != null && sameCinemaName.Count > 0)
            {
                return(new CreateCinemaResultModel
                {
                    IsSuccessful = false,
                    ErrorMessage = Messages.CINEMA_SAME_NAME
                });
            }

            Data.Cinema cinemaToCreate = new Data.Cinema()
            {
                Name = newCinemaWithAuditorium.CinemaName
            };

            var cinemaData = _cinemasRepository.Insert(cinemaToCreate);

            if (cinemaData == null)
            {
                return(new CreateCinemaResultModel
                {
                    IsSuccessful = false,
                    ErrorMessage = Messages.CINEMA_CREATION_ERROR
                });
            }

            _cinemasRepository.Save();

            AuditoriumDomainModel auditoriumToCreate = new AuditoriumDomainModel()
            {
                CinemaId = cinemaData.Id,
                Name     = newCinemaWithAuditorium.AuditoriumName
            };

            var auditoriumData = await _auditoriumService.CreateAuditorium(auditoriumToCreate, newCinemaWithAuditorium.NumberOfRows, newCinemaWithAuditorium.NumberOfColumns);

            if (auditoriumData == null)
            {
                return(new CreateCinemaResultModel
                {
                    IsSuccessful = false,
                    ErrorMessage = Messages.AUDITORIUM_CREATION_ERROR
                });
            }


            List <AuditoriumDomainModel> auditoriumDomainModels = new List <AuditoriumDomainModel>();

            auditoriumDomainModels.Add(auditoriumData.Auditorium);

            CinemaDomainModel createdCinema = new CinemaDomainModel()
            {
                Id              = cinemaData.Id,
                Name            = cinemaData.Name,
                AuditoriumsList = auditoriumDomainModels
            };

            CreateCinemaResultModel cinemaResultModel = new CreateCinemaResultModel()
            {
                IsSuccessful = true,
                ErrorMessage = null,
                Cinema       = createdCinema
            };

            return(cinemaResultModel);
        }
Beispiel #21
0
        public async Task <CreateCinemaResultModel> AddCinemaWithAuditoriumsAndSeats(CreateCinemaDomainModel newCinema)
        {
            var checkName = await _cinemasRepository.GetByNameAsync(newCinema.CinemaName);

            if (checkName != null)
            {
                return(new CreateCinemaResultModel
                {
                    ErrorMessage = Messages.CINEMA_SAME_NAME,
                    IsSuccessful = false
                });
            }

            Data.Cinema newCinemaToAdd = new Data.Cinema
            {
                Name        = newCinema.CinemaName,
                Auditoriums = new List <Auditorium>()
            };

            var listofAuditoriums = newCinema.listOfAuditoriums;

            foreach (var item in listofAuditoriums)
            {
                newCinemaToAdd.Auditoriums.Add(new Auditorium
                {
                    Name  = item.Name,
                    Seats = new List <Seat>()
                });

                var auditoriumName = newCinemaToAdd.Auditoriums.FirstOrDefault(x => x.Name.Equals(item.Name)).Name;

                for (int i = 1; i < item.SeatRows + 1; i++)
                {
                    for (int j = 1; j < item.NumberOfSeats + 1; j++)
                    {
                        Seat seat = new Seat()
                        {
                            Row    = i,
                            Number = j
                        };
                        newCinemaToAdd.Auditoriums.SingleOrDefault(x => x.Name.Equals(auditoriumName)).Seats.Add(seat);
                    }
                }
            }

            Data.Cinema insertedCinema = _cinemasRepository.Insert(newCinemaToAdd);
            if (insertedCinema == null)
            {
                return(new CreateCinemaResultModel
                {
                    IsSuccessful = false,
                    ErrorMessage = Messages.CINEMA_CREATION_ERROR
                });
            }

            _cinemasRepository.Save();

            CreateCinemaResultModel createCinemaResultModel = new CreateCinemaResultModel
            {
                IsSuccessful = true,
                ErrorMessage = null,
                Cinema       = new CinemaDomainModel
                {
                    Id   = insertedCinema.Id,
                    Name = insertedCinema.Name,
                    AuditoriumDomainModels = new List <AuditoriumDomainModel>()
                }
            };

            foreach (var insertedAuditorium in insertedCinema.Auditoriums)
            {
                createCinemaResultModel.Cinema.AuditoriumDomainModels.Add(new AuditoriumDomainModel
                {
                    CinemaId = insertedAuditorium.CinemaId,
                    Id       = insertedAuditorium.Id,
                    Name     = insertedAuditorium.Name
                });
            }
            return(createCinemaResultModel);
        }
Beispiel #22
0
        public async Task <CinemaDomainModel> CreateCinemaAsync(CinemaDomainModel cinemaDomainModel, int numOfSeats, int numOfRows, string auditoriumName)
        {
            var city = await _citiesRepository.GetByIdAsync(cinemaDomainModel.CityId);

            if (city == null)
            {
                return(null);
            }

            var cinemas = await _cinemasRepository.GetAll();

            var cinemasInSameCity = cinemas.Where(c => c.CityId == cinemaDomainModel.CityId);

            foreach (var cin in cinemasInSameCity)
            {
                if (cin.Name == cinemaDomainModel.Name)
                {
                    return(null);
                }
            }

            Data.Cinema newCinema = new Data.Cinema
            {
                Name   = cinemaDomainModel.Name,
                CityId = cinemaDomainModel.CityId
            };

            newCinema.Auditoriums = new List <Auditorium>();

            Auditorium auditorium = new Auditorium
            {
                AuditName = auditoriumName
            };

            auditorium.Seats = new List <Seat>();

            for (int j = 1; j <= numOfRows; j++)
            {
                for (int k = 1; k <= numOfSeats; k++)
                {
                    Seat seat = new Seat
                    {
                        Row    = j,
                        Number = k
                    };

                    auditorium.Seats.Add(seat);
                }
            }

            newCinema.Auditoriums.Add(auditorium);


            Data.Cinema insertedCinema = _cinemasRepository.Insert(newCinema);

            if (insertedCinema == null)
            {
                return(null);
            }

            _cinemasRepository.Save();

            if (insertedCinema == null)
            {
                return(null);
            }

            CinemaDomainModel cinemaModel = new CinemaDomainModel
            {
                Id              = insertedCinema.Id,
                Name            = insertedCinema.Name,
                CityId          = insertedCinema.CityId,
                AuditoriumsList = new List <AuditoriumDomainModel>()
            };

            foreach (var auditoriumInserted in insertedCinema.Auditoriums)
            {
                AuditoriumDomainModel modelAuditorium = new AuditoriumDomainModel
                {
                    Id        = auditoriumInserted.Id,
                    CinemaId  = insertedCinema.Id,
                    Name      = auditoriumInserted.AuditName,
                    SeatsList = new List <SeatDomainModel>()
                };

                foreach (var seat in auditoriumInserted.Seats)
                {
                    modelAuditorium.SeatsList.Add(new SeatDomainModel
                    {
                        Id           = seat.Id,
                        AuditoriumId = auditoriumInserted.Id,
                        Number       = seat.Number,
                        Row          = seat.Row
                    });
                }

                cinemaModel.AuditoriumsList.Add(modelAuditorium);
            }

            return(cinemaModel);
        }