Exemplo n.º 1
0
        /// <summary>
        /// Updates an UpdateAuditData object  using the creator information from the model as the updater
        /// information. Useful when you are mapping audit information from two different objects. If the
        /// db record is null then an ArgumentNullException is thrown.
        /// </summary>
        /// <param name="model">ICreateAuditable EF database record to map create data from.</param>
        public void MapUpdateAuditDataUpdaterData(UpdateAuditData updateAuditDatra, ICreateAuditable model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            ValidateUserProperty(model.Creator, nameof(model.Creator));

            updateAuditDatra.UpdateDate = model.CreateDate;
            updateAuditDatra.Updater    = _userMicroSummaryMapper.Map(model.Creator);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Maps an EF model that inherits from ICreateAuditable into a UpdateAuditData object
        /// using only the creator information from the model. Useful when you are mapping audit
        /// information from two different objects. If the db record is null then an ArgumentNullException is thrown.
        /// </summary>
        /// <param name="model">ICreateAuditable EF database record to map create data from.</param>
        public UpdateAuditData MapUpdateAuditDataCreatorData(ICreateAuditable model)
        {
            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }
            ValidateUserProperty(model.Creator, nameof(model.Creator));

            var auditData = new UpdateAuditData();

            auditData.CreateDate = model.CreateDate;
            auditData.Creator    = _userMicroSummaryMapper.Map(model.Creator);

            return(auditData);
        }