Ejemplo n.º 1
0
        /// <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>());
        }
Ejemplo n.º 2
0
        public static TModel ToModel <TModel>(this BaseDTO baseDTO) where TModel : BaseModel
        {
            if (baseDTO == null)
            {
                return(null);
            }

            return(baseDTO.Map <TModel>());
        }