Exemplo n.º 1
0
        public void ShouldUpdateHall()
        {
            //Arrange
            Hall hall = CreateHall();

            hallService.CreateHall(hall);

            string        updatedHallName = "UpdatedName";
            UpdateHallDTO updateHall      = new UpdateHallDTO {
                Id = hall.Id, HallName = updatedHallName, Rows = new List <RowDTO> {
                    new RowDTO {
                        RowIndex = 1, Seats = new List <SeatDTO> {
                            new SeatDTO {
                                ColumnIndex = 1, Status = SeatStatus.Excluded
                            }
                        }
                    }
                }
            };

            //Act
            hallService.UpdateHall(updateHall);

            //Assert
            Assert.Equal(updatedHallName, hall.HallName);
            Assert.Single(hall.Rows);
            Assert.Single(hall.Rows[0].Seats);
        }
Exemplo n.º 2
0
        public bool UpdateHall(UpdateHallDTO updateHall)
        {
            Hall hall = hallRepository.GetByID(updateHall.Id);

            if (hall == null)
            {
                return(false);
            }

            hall.HallName = updateHall.HallName;
            hall.Rows     = updateHall.Rows.Select(r => new Row {
                RowIndex = r.RowIndex, Seats = r.Seats.Select(s => new Seat {
                    ColumnIndex = s.ColumnIndex, Status = s.Status
                }).ToList()
            }).ToList();

            return(hallRepository.SaveChanges() > 0);
        }
Exemplo n.º 3
0
 public ActionResult <List <Hall> > UpdateHall(UpdateHallDTO hall)
 {
     return(Ok(hallService.UpdateHall(hall)));
 }