VideoRentalService.DataFacade1.GetPayment C# (CSharp) Method

GetPayment() public method

public GetPayment ( int id ) : SPayment
id int
return SPayment
        public override SPayment GetPayment(int id)
        {
            SPayment spayment = new SPayment();
            using (SakilaEntities dc = new SakilaEntities())
            {
                var model = from p in dc.payments
                            where p.payment_id == id
                            //orderby (p.payment_date)
                            select p;
                List<payment> payments = model.ToList<payment>();
                spayment = spayment.Createpayment((payments[0].rental_id ?? 0), payments[0].payment_id, payments[0].customer_id,
                    payments[0].staff_id, payments[0].amount, payments[0].payment_date, payments[0].last_update,
                    payments[0].rental.inventory_id, payments[0].rental.inventory.film.title);
            }

            simulator.PerformanceSimulation();

            return spayment;
        }