public void CreateRoom(DTO.Room r) { r.RoomId = roomIDs; roomIDs++; r.Seats = AddSeats(r.Capacity); rooms.Add(r); }
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)); }
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); }
public DTO.Room SelectRoom(int id) { DTO.Room room = null; foreach (DTO.Room r in rooms) { if (r.RoomId == id) { room = r; } } return(room); }
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); }
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); }
public ViewResult AddRoom(DTO.Room r) { TempData["add"] = $"{r.RoomNumber} added!"; icinemamanager.AddRoom(r); return(ListRooms()); }