Esempio n. 1
0
 public void CreateRoom(DTO.Room r)
 {
     r.RoomId = roomIDs;
     roomIDs++;
     r.Seats = AddSeats(r.Capacity);
     rooms.Add(r);
 }
Esempio n. 2
0
        public IActionResult Create(DTO.Room item)
        {
            var dalitem = new DAL.Room();

            dalitem.RoomId     = item.RoomId;
            dalitem.RoomNumber = item.RoomNumber;
            dalitem.Capacity   = item.Capacity;
            DAL.RoomManager.AddRoom(dalitem);
            return(Created("http://localhost:6544/api/rooms", item));
        }
Esempio n. 3
0
 public DTO.MovieEventSeat GetSeat(int seatID, int roomID)
 {
     DTO.Room room = SelectRoom(roomID);
     foreach (DTO.MovieEventSeat s in room.Seats.ToList())
     {
         if (s.SeatId == seatID)
         {
             return(s);
         }
     }
     return(null);
 }
Esempio n. 4
0
 public DTO.Room SelectRoom(int id)
 {
     DTO.Room room = null;
     foreach (DTO.Room r in rooms)
     {
         if (r.RoomId == id)
         {
             room = r;
         }
     }
     return(room);
 }
Esempio n. 5
0
 public ActionResult <DTO.Room> GetById(int id)
 {
     DTO.Room dtoroom = new DTO.Room();
     dtoroom.Seats = new List <DTO.MovieEventSeat>();
     DAL.Room dalroom = DAL.RoomManager.GetRoomById(id);
     dtoroom.RoomId     = dalroom.RoomId;
     dtoroom.Capacity   = dalroom.Capacity;
     dtoroom.RoomNumber = dalroom.RoomNumber;
     dtoroom.Seats      = new List <DTO.MovieEventSeat>();
     foreach (var dalseat in dalroom.Seats)
     {
         DTO.MovieEventSeat s = new DTO.MovieEventSeat();
         s.SeatId     = dalseat.SeatId;
         s.RowNumber  = dalseat.RowNumber;
         s.SeatNumber = dalseat.SeatNumber;
         dtoroom.Seats.Add(s);
     }
     return(dtoroom);
 }
Esempio n. 6
0
        public ActionResult <List <DTO.Room> > Get()
        {
            List <DTO.Room> dtorooms = new List <DTO.Room>();
            List <DAL.Room> dalrooms = DAL.RoomManager.ListRooms();

            foreach (var room in dalrooms)
            {
                DTO.Room dtoroom = new DTO.Room();
                dtoroom.RoomId     = room.RoomId;
                dtoroom.Capacity   = room.Capacity;
                dtoroom.RoomNumber = room.RoomNumber;
                dtoroom.Seats      = new List <DTO.MovieEventSeat>();
                foreach (var dalseat in room.Seats)
                {
                    DTO.MovieEventSeat s = new DTO.MovieEventSeat();
                    s.SeatId     = dalseat.SeatId;
                    s.RowNumber  = dalseat.RowNumber;
                    s.SeatNumber = dalseat.SeatNumber;
                    dtoroom.Seats.Add(s);
                }
                dtorooms.Add(dtoroom);
            }
            return(dtorooms);
        }
Esempio n. 7
0
 public ViewResult AddRoom(DTO.Room r)
 {
     TempData["add"] = $"{r.RoomNumber} added!";
     icinemamanager.AddRoom(r);
     return(ListRooms());
 }