public static Entities.Job Add(Entities.Job item) { Entities.Job result = new Entities.Job(); var dbContext = new Naboo.DataAccess.Model.OSAgnosticContext(ConnectionHandler.ConnectionString()); Naboo.DataAccess.Model.Job jobDb = item.Convert(); dbContext.Job.Add(jobDb); dbContext.SaveChanges(); result = jobDb.Convert(); return(result); }
public static Naboo.DataAccess.Model.Job Convert(this Naboo.Entities.Job item) { Naboo.DataAccess.Model.Job result = new Naboo.DataAccess.Model.Job(); result.Code = item.Code; result.Name = item.Name; result.Interval = (int)item.Interval; result.HostId = item.HostId; result.OSType = item.OSType; result.CreateDate = DateTime.Now; result.UpdateDate = DateTime.Now; result.State = true; return(result); }