private void Btn_Save_Click(object sender, EventArgs e)
 {
     using (DepoziteDbContext db = new DepoziteDbContext())
     {
         decimal amount;
         Decimal.TryParse(Txb_Price.Text, out amount);
         if (amount != 0)
         {
             db.Credits.Add(new Credit()
             {
                 Amount       = amount,
                 OpenDatetime = Dtp_CrediteDate.Value,
                 Person_Id    = db.People.ToList().Last().Id,
             });
             db.SaveChanges();
         }
     }
 }
        private void Btn_Save_Click(object sender, EventArgs e)
        {
            using (DepoziteDbContext db = new DepoziteDbContext())
            {
                try
                {
                    db.People.Add(new Person()
                    {
                        Name          = Txb_Name.Text,
                        Surname       = Txb_Surname.Text,
                        PasportNumber = Txb_PasportNumber.Text
                    });

                    db.SaveChanges();

                    new AddCredite().ShowDialog();
                }
                catch (DbEntityValidationException ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }