public ContractorForm(int id) { InitializeComponent(); dbContext = new DB.DBModel(); this.currentID = id; if (currentID != 0) { currentContractor = dbContext.Contractors.First(x => x.ID == id); FillExistingContractor(); Text = currentContractor.Name; } else { currentContractor = new DB.Contractors(); Text = "Новый контрагент"; } fillContorls(); }
public void RemoveContractor(int id) { DB.Contractors currContractor = dbContext.Contractors.First(x => x.ID == id); currContractor.IsRemoved = true; dbContext.SaveChanges(); }