Add IHasChangedWhen support and cleanup using statements
Introduced IHasChangedWhen interface to EnvelopeReceiver and History. Added HasEmailAndName property to EnvelopeReceiver. Updated AutoMapperAuditingExtensions to map ChangedWhen to UTC. Removed redundant using statements and fixed formatting.
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using AutoMapper;
|
||||
using EnvelopeGenerator.Application.EmailTemplates;
|
||||
using EnvelopeGenerator.Application.EmailTemplates.Commands;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using AutoMapper;
|
||||
using EnvelopeGenerator.Domain.Interfaces.Auditing;
|
||||
|
||||
@@ -22,4 +21,4 @@ public static class AutoMapperAuditingExtensions
|
||||
public static IMappingExpression<TSource, TDestination> MapChangedWhen<TSource, TDestination>(this IMappingExpression<TSource, TDestination> expression)
|
||||
where TDestination : IHasChangedWhen
|
||||
=> expression.ForMember(dest => dest.ChangedWhen, opt => opt.MapFrom(_ => DateTime.UtcNow));
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using DigitalData.Core.Abstractions.Interfaces;
|
||||
using EnvelopeGenerator.Domain.Interfaces;
|
||||
using EnvelopeGenerator.Domain.Interfaces.Auditing;
|
||||
|
||||
namespace EnvelopeGenerator.Domain.Entities
|
||||
{
|
||||
@@ -86,6 +87,8 @@ namespace EnvelopeGenerator.Domain.Entities
|
||||
|
||||
[NotMapped]
|
||||
public bool HasEmailAndName =>
|
||||
!string.IsNullOrWhiteSpace(Receiver.EmailAddress) &&
|
||||
!string.IsNullOrWhiteSpace(Name);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
using EnvelopeGenerator.Domain.Interfaces;
|
||||
using EnvelopeGenerator.Domain.Constants;
|
||||
using DigitalData.Core.Abstractions.Interfaces;
|
||||
using EnvelopeGenerator.Domain.Interfaces.Auditing;
|
||||
|
||||
namespace EnvelopeGenerator.Domain.Entities
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user