Esempio n. 1
0
        private void buttonReturnRental_Click(object sender, System.EventArgs e)
        {
            ActiveRentalView selectedRentalView = (ActiveRentalView)dataGridViewActiveRentals.CurrentRow?.DataBoundItem;

            if (selectedRentalView != null)
            {
                MainController.ReturnRental(selectedRentalView.RentalId);
                UpdateGrid();
            }
        }
Esempio n. 2
0
        private void UpdateGrid()
        {
            var activeRentalsList = new List <ActiveRentalView>();

            foreach (var item in MainController.GetAllActiveRentals())
            {
                string boardGames = "";
                foreach (var boardGame in item.BoardGames)
                {
                    boardGames += boardGame.Name + ",";
                }

                var rental = new ActiveRentalView
                {
                    RentalId         = item.RentalId,
                    MemberName       = item.Member.Name,
                    BoardGames       = boardGames.Remove(boardGames.Length - 1),
                    EmployeeUsername = item.Employee?.Username,
                    DateRented       = item.DateRented
                };
                activeRentalsList.Add(rental);
            }
            dataGridViewActiveRentals.DataSource = activeRentalsList;
        }