Exemple #1
0
        public void Insert(IRoomCreation room)
        {
            Room newRoom = new Room(room.Number, room.SeatsPerRow, room.Rows, room.CinemaId);

            db.Rooms.Add(newRoom);
            db.SaveChanges();
        }
Exemple #2
0
        public async Task Insert(IRoomCreation room)
        {
            Room newRoom = new Room(room.Number, room.SeatsPerRow, room.Rows, room.CinemaId);

            this.db.Rooms.Add(newRoom);
            await this.db.SaveChangesAsync();
        }
Exemple #3
0
        public async Task <NewSummary> New(IRoomCreation model)
        {
            IRoom room = await this.roomRepo.GetByCinemaAndNumber(model.CinemaId, model.Number);

            if (room != null)
            {
                return(new NewSummary(false, StringConstants.RoomExists));
            }

            return(await newRoom.New(model));
        }
        public async Task <NewSummary> New(IRoomCreation model)
        {
            var cinema = await this.cinemaRepo.GetById(model.CinemaId);

            if (cinema == null)
            {
                return(new NewSummary(false, $"Cinema with id {model.CinemaId} does not exist"));
            }

            return(await newRoom.New(model));
        }
Exemple #5
0
        public async Task <NewSummary> New(IRoomCreation room)
        {
            await this.roomRepo.Insert(new Room(room.Number, room.SeatsPerRow, room.Rows, room.CinemaId));

            return(new NewSummary(true));
        }