private void button2_Click(object sender, EventArgs e) { if (textBox1.Text.Length <= 0) { MessageBox.Show("Enter a name", "Erorr"); } else { Lot new_lot = new Lot(); new_lot.SalerId = user.Id; new_lot.Name = textBox1.Text; new_lot.MinBid = Convert.ToInt32(numericUpDown3.Value); new_lot.StartTime = Convert.ToInt32(numericUpDown1.Value * 60 + numericUpDown2.Value); new_lot.Description = richTextBox1.Text; new_lot.Date = dateTimePicker1.Value.ToString(); lotRepository.Create(new_lot); Close(); } }