public PlcConnectorModule Add(PLCConnectorModuleConfigure p_configure) { PlcConnectorModule objTemp = new PlcConnectorModule(p_configure); PlcConnectorModulesList.Add(objTemp); using (var db = new MES_DATABASE()) { db.PLC_PLCConnectorable.Add(new PLC_PLCConnector() { ID_PLC = objTemp.Id, Status = (int)objTemp.EModuleState, IP = objTemp.PlcModuleConfigure.IpString, Port = objTemp.PlcModuleConfigure.PortString, Rack = objTemp.PlcModuleConfigure.Rack, Slot = objTemp.PlcModuleConfigure.Slot, TimeCreated = DateTime.Now, TimeModified = DateTime.Now, P_Created = "Honza", P_Modified = "Honza" }); db.SaveChanges(); } return(objTemp); }
public IEnumerable <PlcConnectorModule> Retrieve() { if (PlcConnectorModulesList != null) { return(PlcConnectorModulesList.ToList()); } return(null); }