public CustomIncidentDTO MapToCustomIncidentDTO(CustomIncidentEntity source, CustomIncidentDTO target = null) { if (source == null) { return(null); } if (target == null) { target = new CustomIncidentDTO(); } target.IncidentId = source.IncidentId; target.Index = source.Index; target.Text = source.Text; return(target); }
public CustomIncidentEntity MapToCustomIncidentEntity(CustomIncidentDTO source, CustomIncidentEntity target = null) { if (source == null) { return(null); } // search for target in database if (target == null) { DefaultGet(source, ref target); } // if target is not in database, create if (target == null) { target = DbContext.CustomIncidentKinds.Create(); DbContext.CustomIncidentKinds.Add(target); } target.Index = source.Index; target.Text = source.Text; return(target); }