private void TechViewAutoDataGrid_RowEditEnding(object sender, DataGridRowEditEndingEventArgs e) { if (e.EditAction == DataGridEditAction.Commit) { TechnicalInspections newItem = e.Row.DataContext as TechnicalInspections; newItem.AutoID = Data.IdAuto; new DAO().AddTechnical(newItem); } }
public void AddTechnical(TechnicalInspections tech) { using (DBContext db = new DBContext()) { db.TechnicalInspections.Add(new TechnicalInspections { AutoID = tech.AutoID, DateSee = tech.DateSee, Distance = tech.Distance, Inspector = tech.Inspector, Okey = tech.Okey, Reason = tech.Reason, Work = tech.Work, YearNumber = tech.YearNumber }); db.SaveChanges(); } }