public static void ToEntity(DT.JobData source, JobData target) { if ((source != null) && (target != null)) { target.JobId = source.JobId; target.Data = new Binary(source.Data); target.LastUpdate = source.LastUpdate; } }
public Guid AddJobData(DT.JobData dto) { using (var db = CreateContext(true)) { var entity = Convert.ToEntity(dto); db.JobDatas.InsertOnSubmit(entity); db.SubmitChanges(); return(entity.JobId); } }
public static JobData ToEntity(DT.JobData source) { if (source == null) { return(null); } var entity = new JobData(); ToEntity(source, entity); return(entity); }
public void UpdateJobData(DT.JobData dto) { using (var db = CreateContext(true)) { var entity = db.JobDatas.FirstOrDefault(x => x.JobId == dto.JobId); if (entity == null) { db.JobDatas.InsertOnSubmit(Convert.ToEntity(dto)); } else { Convert.ToEntity(dto, entity); } db.SubmitChanges(); } }