public ResponseMessageGetRooms GetRooms(RequestMessageGetRooms request) { ResponseMessageGetRooms response = new ResponseMessageGetRooms(); if (string.IsNullOrEmpty(request.BuildingCode)) { throw new Exception("Building code cannot be empty"); //TODO gör om till ett businessexception } if (string.IsNullOrEmpty(request.FloorCode)) { throw new Exception("Floor code cannot be empty"); //TODO gör om till ett businessexception } List <Room> roomList = new List <Room>(); List <BLroom> blRoomList = dbPrisma.BLroom.Where(x => x.blbuilding_code == request.BuildingCode && x.blfloor_code == request.FloorCode).ToList(); foreach (var blRoom in blRoomList) { Room room = new Room(); room.RoomCode = blRoom.blroom_code; room.Description = blRoom.descr; roomList.Add(room); } response.Rooms = roomList; return(response); }
public ResponseMessageGetRooms GetRooms(RequestMessageGetRooms request) { ResponseMessageGetRooms response = new ResponseMessageGetRooms(); if (string.IsNullOrEmpty(request.BuildingCode)) throw new Exception("Building code cannot be empty"); //TODO gör om till ett businessexception if (string.IsNullOrEmpty(request.FloorCode)) throw new Exception("Floor code cannot be empty"); //TODO gör om till ett businessexception List<Room> roomList = new List<Room>(); List<BLroom> blRoomList = dbPrisma.BLroom.Where(x => x.blbuilding_code == request.BuildingCode && x.blfloor_code == request.FloorCode).ToList(); foreach (var blRoom in blRoomList) { Room room = new Room(); room.RoomCode = blRoom.blroom_code; room.Description = blRoom.descr; roomList.Add(room); } response.Rooms = roomList; return response; }