VideoRentalService.DataFacade1.GetRentals C# (CSharp) Method

GetRentals() public method

public GetRentals ( int customerid ) : VideoRentalService.SRental[]
customerid int
return VideoRentalService.SRental[]
        public override SRental[] GetRentals(int customerid)
        {
            List<SRental> srentlist = new List<SRental>();
            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from r in dc.rentals
                            where r.customer_id == customerid
                            orderby (r.return_date)
                            select r;

                List<rental> rentalList = model.ToList<rental>();

                simulator.PerformanceSimulation();

                for (int i = 0; i < rentalList.Count; i++)
                {
                    SRental rental = new SRental();
                    if (rentalList[i].return_date.HasValue)
                    {
                        rental = rental.Createrental(rentalList[i].rental_id, rentalList[i].rental_date, rentalList[i].return_date, rentalList[i].inventory_id, rentalList[i].customer_id, rentalList[i].staff_id, rentalList[i].last_update);
                    }
                    else
                    {
                        rental = rental.Createrental(rentalList[i].rental_id, rentalList[i].rental_date, rentalList[i].inventory_id, rentalList[i].customer_id, rentalList[i].staff_id, rentalList[i].last_update);
                    }
                    rental.Filmtitle = rentalList[i].inventory.film.title;
                    srentlist.Add(rental);
                }
            }
            return srentlist.ToArray<SRental>();
        }