public IFreeSeatList GetFreeSeatFromBase(IBookingValueForSeat bookingValueForSeat) { freeSeat = Base.GetFreeSeat(bookingValueForSeat, freeSeat); freeSeatlist = repository.InsertIntoFreeSeatList(freeSeat, bookingValueForSeat); return(freeSeatlist); }
public FreeTrainCar GetFreeSeat(IBookingValueForSeat bookingValueForSeat, FreeTrainCar freeSeat) { using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["RW"].ConnectionString)) { var sql = "exec [FindAllPlaceProc] @TrainRouteId, @StationFrom, @StationTo, @CarType, @Date,@Time"; var values = new { bookingValueForSeat.TrainRouteId, bookingValueForSeat.StationFrom, bookingValueForSeat.StationTo, bookingValueForSeat.CarType, bookingValueForSeat.Date, bookingValueForSeat.Time }; using (var multi = connection.QueryMultiple(sql, values)) { freeSeat.freeTrain = multi.Read <FreeTrainInfo>().ToList(); freeSeat.freeCar = multi.Read <FreeCarInfo>().ToList(); freeSeat.freeSeat = multi.Read <CarSeat>().ToList(); } } return(freeSeat); }