private int getFreeSpaces(string lot_id, string max_vehicle) { DateTime dt = DateTime.Now; BookingModel bkm = new BookingModel(); bkm.lot_id = lot_id; bkm.day = dt.ToString("dd/MM/yyyy"); bkm.status = "0"; int countBookings = bkm.getAllBookingByLotDayStatus().Count(); LogModel lgm = new LogModel(); lgm.lot_id = lot_id; lgm.day = dt.ToString("dd/MM/yyyy"); int engagedCount = lgm.getAllLogsbyLotDayOutTime().Count(); int freeCount = int.Parse(max_vehicle) - (engagedCount + countBookings); return(freeCount); }