private void LoadData() { if (maintID != null) { var maintRecord = from maintInfo mi in App.ViewModel.Database.maintInfo where mi.CarID == int.Parse(carID) && mi.MaintID == int.Parse(maintID) select mi; CurrentMaintInfo = maintRecord.FirstOrDefault(); } else if (CurrentMaintInfo == null) { CurrentMaintInfo = new maintInfo { Date = DateTime.Now, DateStr = DateTime.Now.ToShortDateString(), CarID = int.Parse(carID) }; } this.DataContext = CurrentMaintInfo; }
public void DeleteMaint(maintInfo toDelete) { carDataDb.maintInfo.DeleteOnSubmit(toDelete); Maint.Remove(toDelete); carDataDb.SubmitChanges(); }
public void AddMaint(maintInfo newMaint) { carDataDb.maintInfo.InsertOnSubmit(newMaint); carDataDb.SubmitChanges(); Maint.Add(newMaint); }