public static void ToEntity(DT.Downtime source, Downtime target) { if ((source != null) && (target != null)) { target.DowntimeId = source.Id; target.AllDayEvent = source.AllDayEvent; target.EndDate = source.EndDate; target.Recurring = source.Recurring; target.RecurringId = source.RecurringId; target.ResourceId = source.ResourceId; target.StartDate = source.StartDate; } }
public Guid AddDowntime(DT.Downtime dto) { using (var db = CreateContext()) { var entity = Convert.ToEntity(dto); db.Downtimes.InsertOnSubmit(entity); db.SubmitChanges(); return(entity.DowntimeId); } }
public static Downtime ToEntity(DT.Downtime source) { if (source == null) { return(null); } var entity = new Downtime(); ToEntity(source, entity); return(entity); }
public void UpdateDowntime(DT.Downtime dto) { using (var db = CreateContext()) { var entity = db.Downtimes.FirstOrDefault(x => x.DowntimeId == dto.Id); if (entity == null) { db.Downtimes.InsertOnSubmit(Convert.ToEntity(dto)); } else { Convert.ToEntity(dto, entity); } db.SubmitChanges(); } }