/// <summary> /// Execute a mapping from the model to a new entity /// </summary> /// <typeparam name="TEntity">Entity type</typeparam> /// <param name="model">Model to map from</param> /// <returns>Mapped entity</returns> public static TEntity ToEntity <TEntity>(this BaseDTO model) where TEntity : BaseEntity { if (model == null) { throw new ArgumentNullException(nameof(model)); } return(model.Map <TEntity>()); }
public static TModel ToModel <TModel>(this BaseDTO baseDTO) where TModel : BaseModel { if (baseDTO == null) { return(null); } return(baseDTO.Map <TModel>()); }