private void buttonEditClothe_Click(object sender, EventArgs e) { var selectedClotheIndex = Int32.Parse(dataGridViewClothes.SelectedRows[0].Cells[0].Value.ToString()); _clothes.DeleteById(selectedClotheIndex); _clothes.Save(); LoadClothes(); var addClotheClothe = textBoxClothe.Text; var addClothePrice = textBoxPrice.Text; var addClotheDate = dateTimePickerDate.Text; var brandId = textBoxBrandId.Text; AddClothe newClothe = new AddClothe { Clothe = addClotheClothe, Price = Int32.Parse(addClothePrice), Date = Convert.ToDateTime(addClotheDate), BrandId = Int32.Parse(brandId) }; _clothes.Create(newClothe); _clothes.Save(); LoadClothes(); }
private void buttonAdd_Click(object sender, EventArgs e) { var addClotheClothe = textBoxClothe.Text; var addClothePrice = textBoxPrice.Text; var addClotheDate = dateTimePickerDate.Text; var brandId = textBoxBrandId.Text; AddClothe newClothe = new AddClothe { Clothe = addClotheClothe, Price = Int32.Parse(addClothePrice), Date = Convert.ToDateTime(addClotheDate), BrandId = Int32.Parse(brandId) }; _clothes.Create(newClothe); _clothes.Save(); LoadClothes(); }