public RentalContract FindRentalContract(int?id)
        {
            RentalContract contract = null;

            foreach (var rent in GetRentalContracts())
            {
                if (rent.RentalContractID == id)
                {
                    contract = rent;
                    break;
                }
            }

            return(contract);
        }
        //Rental Contracts
        public List <RentalContract> GetRentalContracts()
        {
            List <RentalContract> rentalContracts = new List <RentalContract>();

            using (SqlConnection scApartmentsManagement = new SqlConnection(System.
                                                                            Configuration.
                                                                            ConfigurationManager.
                                                                            ConnectionStrings["csApartmentsRentalManagement"].
                                                                            ConnectionString))
            {
                SqlCommand cmdRentalContracts = new SqlCommand("SELECT RentalContractID, ContractNumber, EmployeeID, " +
                                                               "       ContractDate, FirstName, LastName, " +
                                                               "       MaritalStatus, NumberOfChildren, " +
                                                               "       ApartmentID, RentStartDate " +
                                                               "FROM   Management.RentalContracts;",
                                                               scApartmentsManagement);

                scApartmentsManagement.Open();
                cmdRentalContracts.ExecuteNonQuery();

                SqlDataAdapter sdaRentalContracts = new SqlDataAdapter(cmdRentalContracts);
                DataSet        dsRentalContracts  = new DataSet("rent-contracts");

                sdaRentalContracts.Fill(dsRentalContracts);

                for (int i = 0; i < dsRentalContracts.Tables[0].Rows.Count; i++)
                {
                    RentalContract contract = new RentalContract()
                    {
                        RentalContractID = int.Parse(dsRentalContracts.Tables[0].Rows[i][0].ToString()),
                        ContractNumber   = int.Parse(dsRentalContracts.Tables[0].Rows[i][1].ToString()),
                        EmployeeID       = int.Parse(dsRentalContracts.Tables[0].Rows[i][2].ToString()),
                        ContractDate     = DateTime.Parse(dsRentalContracts.Tables[0].Rows[i][3].ToString()),
                        FirstName        = dsRentalContracts.Tables[0].Rows[i][4].ToString(),
                        LastName         = dsRentalContracts.Tables[0].Rows[i][5].ToString(),
                        MaritalStatus    = dsRentalContracts.Tables[0].Rows[i][6].ToString(),
                        NumberOfChildren = int.Parse(dsRentalContracts.Tables[0].Rows[i][7].ToString()),
                        ApartmentID      = int.Parse(dsRentalContracts.Tables[0].Rows[i][8].ToString()),
                        RentStartDate    = DateTime.Parse(dsRentalContracts.Tables[0].Rows[i][9].ToString())
                    };

                    rentalContracts.Add(contract);
                }
            }

            return(rentalContracts);
        }