public Machine CreateMachine(MachineModel newMachine) { var Machine = MachineUtil.CastToDbo(newMachine); var connectionStrings = Machine.ConnectionStrings; Machine.ConnectionStrings = null; var savedMachine = _MachineRepository.Create(Machine); if (connectionStrings != null) { foreach (var conStr in connectionStrings) { conStr.MachineId = savedMachine.MachineId; _connectionStringRepository.Create(conStr); } } return(_MachineRepository.GetByMachineId(savedMachine.MachineId)); }
public ConnectionString CreateConnectionString(ConnectionStringModel newConnectionString) { var ConnectionString = ConnectionStringUtil.CastToDbo(newConnectionString); return(_ConnectionStringRepository.Create(ConnectionString)); }