private void DisplayCard(MaintenanceCardDataModel card) { var f = (card.Finished) ? "Finished" : "Not Finished"; string d = $"Date of arrival: {card.DateOfArrival.ToShortDateString()} - Maintenance Status: {f}"; this.Invoke(new Action(() => lb_MH.Items.Add(d))); }
public Card(AutomobileController automobileController, MiscController miscController, MaintenanceCardDataModel card) { InitializeComponent(); this.AutomobileController = automobileController; this.MiscController = miscController; this.CardModel = card; }
public void SaveAutomobile(AutomobileSaveToken token) { var model = MakeModelFromToken(token); var mc = new MaintenanceCardDataModel(); model.MaintenanceCards.Add(mc); mc.Automobile = model; mc.AutomobileId = model.Id; context.Automobiles.Add(model); context.Maintenances.Add(mc); context.SaveChanges(); }
public void AddMaintenanceCard(int automobileId) { var auto = context.Automobiles.FirstOrDefault(a => a.Id == automobileId); if (auto != null) { var mc = new MaintenanceCardDataModel(); auto.MaintenanceCards.Add(mc); mc.Automobile = auto; mc.AutomobileId = auto.Id; context.Maintenances.Add(mc); context.SaveChanges(); } }
public void SaveMaintenanceCard(MaintenanceCardDataModel Model) { EditEntity <MaintenanceCardDataModel>(Model); }