Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Games checkOutGame = new Games();
        TestGameRepository testGame = new TestGameRepository();
        GameGridView.DataSource = testGame.GetItems();
        GameGridView.DataBind();

        var nonCheckedOutGame = from g in testGame.GetItems()
                                where g.IsCheckedOut == false
                                select g.GameName;
        DropDownList1.DataSource = nonCheckedOutGame.ToList();
        DropDownList1.DataBind();

        var toBeCheckedOuts = from g in testGame.GetItems()
                             where g.GameName == DropDownList1.SelectedItem.ToString()
                             select g;
        checkOutGame = toBeCheckedOuts.FirstOrDefault();
        checkOutGame.IsCheckedOut = true;
    }
Example #2
0
 protected void AddGameBtn_Click(object sender, EventArgs e)
 {
     TestGameRepository testGame = new TestGameRepository();
     gameRating = DropDownList1.SelectedValue.ToString();
     gameName = TextBox1.Text;
     Games newGame = new Games();
     newGame.GameName = gameName;
     newGame.GameRating = gameRating;
     newGame.IsCheckedOut = false;
     newGame.CheckedOutTo = string.Empty;
     testGame.Add(newGame);
     GridView1.DataSource = testGame.GetItems();
     GridView1.DataBind();
 }