private void BtnAdd_Click(object sender, EventArgs e) { Validation(); Company comp = new Company(); comp.Name = TxtCompName.Text; _context.Companies.Add(comp); _context.SaveChanges(); FillCompanies(); ResetForm(); EmptyText(); }
private void BtnAdd_Click(object sender, EventArgs e) { Validation(); Person prs = new Person(); prs.FullName = TxtFullName.Text; prs.PhoneNumber = TxtPhoneNumber.Text; prs.WorkNumber = TxtWorkNumber.Text; prs.Email = TxtEmail.Text; prs.CompanyId = _context.Companies.FirstOrDefault(c => c.Name == CmbCompanyList.Text).Id; _context.People.Add(prs); _context.SaveChanges(); FillPeople(); ResetForm(); EmptyText(); }