public AppendixData GetAppendixPluginID() { using (ToolViewContext db = new ToolViewContext()) { AppendixData appData = new AppendixData(); try { appData = db.Appendix.FirstOrDefault(); } catch (Exception e) { Debug.WriteLine("Error: 921234" + e); } return(appData); } }
public void SetAppendixPluginID(int pluginID) { using (ToolViewContext db = new ToolViewContext()) { AppendixData appData = new AppendixData(); try { if (db.Appendix.Any()) { AppendixData recordDelete = db.Appendix.FirstOrDefault(); db.Appendix.Remove(recordDelete); db.SaveChanges(); } appData.pluginID = pluginID; db.Appendix.Add(appData); db.SaveChanges(); } catch (Exception e) { Debug.WriteLine("Error: 921234" + e); } } }