public static Host Add(Host item) { Host result = new Host(); var dbContext = new Naboo.DataAccess.Model.OSAgnosticContext(ConnectionHandler.ConnectionString()); Naboo.DataAccess.Model.Host hostDb = item.Convert(); dbContext.Host.Add(hostDb); dbContext.SaveChanges(); result = hostDb.Convert(); return(result); }
public static Naboo.DataAccess.Model.Host Convert(this Naboo.Entities.Host item) { Naboo.DataAccess.Model.Host result = new Naboo.DataAccess.Model.Host(); result.IPLocal = item.IPLocal; result.IPPublic = item.IPPublic; result.MacAddress = item.MacAddress; result.Name = item.Name; result.OSArchitecture = item.OS.Architecture; result.OSName = item.OS.Name; result.OSRelease = item.OS.Release; result.OSSystem = item.OS.System; result.State = item.State; result.UpdateDate = DateTime.Now; result.CreateDate = DateTime.Now; return(result); }