public void TestUpdateArt() { Console.WriteLine("TestUpdateArt called"); Art aTemp = ctrArt.RetrieveByNo(1020); Assert.IsNotNull(aTemp, "aTemp is found"); aTemp.Number = 1200; aTemp = ctrArt.Update(aTemp.Id, aTemp.Name, aTemp.Number, aTemp.Artist, aTemp.Description, aTemp.Image, aTemp.StartingBid, aTemp.PurchasePrice); Assert.AreEqual(aTemp.Number, 1200, "Number is not equal"); aTemp = ctrArt.Update(aTemp.Id, aTemp.Name, 1020, aTemp.Artist, aTemp.Description, aTemp.Image, aTemp.StartingBid, aTemp.PurchasePrice); }
private void btnSave_Click(object sender, EventArgs e) { if (txtName.Text != "") { if (grbCreate.Text == "Opret") { ctrArt.Insert(txtName.Text, txtArtist.Text, txtDescription.Text, txtImgUrl.Text, Convert.ToDecimal(txtStartPrice.Text), Convert.ToDecimal(txtPurchasePrice.Text)); } else if (grbCreate.Text == "Rediger") { Art selectedArt = (Art)dgvAtrList.CurrentRow.DataBoundItem; int id = selectedArt.Id; ctrArt.Update(id, txtName.Text, Convert.ToInt32(txtNumber.Text), txtArtist.Text, txtDescription.Text, txtImgUrl.Text, Convert.ToDecimal(txtStartPrice.Text), Convert.ToDecimal(txtPurchasePrice.Text)); } loadArtPieces(); clearTxtBoxes(); } else { MessageBox.Show("Udfyld kunstværkets navn"); } }