diff --git a/IRaCIS.Core.Application/Service/Common/DTO/CommonDocumentViewModel.cs b/IRaCIS.Core.Application/Service/Common/DTO/CommonDocumentViewModel.cs index acbdb6833..b5bed4ba8 100644 --- a/IRaCIS.Core.Application/Service/Common/DTO/CommonDocumentViewModel.cs +++ b/IRaCIS.Core.Application/Service/Common/DTO/CommonDocumentViewModel.cs @@ -16,7 +16,7 @@ namespace IRaCIS.Core.Application.ViewModel //public string ModuleType { get; set; } = String.Empty; - + public DateTime? DeletedTime { get; set; } public DateTime CreateTime { get; set; } public DateTime UpdateTime { get; set; } diff --git a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs index bd7008002..59783aafe 100644 --- a/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs +++ b/IRaCIS.Core.Application/Service/TrialSiteUser/TrialSiteService.cs @@ -16,7 +16,7 @@ namespace IRaCIS.Core.Application.Services private readonly IRepository _trialSiteRepository; private readonly IRepository _trialSiteUserRepository; - public TrialMaintenanceService(IRepository trialSiteRepository,IRepository trialSiteUserRepository) + public TrialMaintenanceService(IRepository trialSiteRepository, IRepository trialSiteUserRepository) { _trialSiteRepository = trialSiteRepository; _trialSiteUserRepository = trialSiteUserRepository; @@ -28,7 +28,7 @@ namespace IRaCIS.Core.Application.Services { var siteStatQuery = _trialSiteRepository.Where(t => t.TrialId == param.TrialId, ignoreQueryFilters: true) - .WhereIf(param.IsDeleted!=null, t => t.IsDeleted==param.IsDeleted) + .WhereIf(param.IsDeleted != null, t => t.IsDeleted == param.IsDeleted) .WhereIf(!string.IsNullOrWhiteSpace(param.SiteName), t => t.Site.SiteName.Contains(param.SiteName)) .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteAliasName), t => t.TrialSiteAliasName.Contains(param.TrialSiteAliasName)) .WhereIf(!string.IsNullOrWhiteSpace(param.TrialSiteCode), t => t.TrialSiteAliasName.Contains(param.TrialSiteCode)) @@ -191,6 +191,8 @@ namespace IRaCIS.Core.Application.Services [TypeFilter(typeof(TrialResourceFilter))] public async Task DeleteSiteCRC(Guid id, bool isDelete) { + + var isSuccess = await _trialSiteUserRepository.UpdateFromQueryAsync(u => u.Id == id, u => new TrialSiteUser() { IsDeleted = isDelete, DeletedTime = isDelete ? DateTime.Now : null }); diff --git a/IRaCIS.Core.Domain/Common/CommonDocument.cs b/IRaCIS.Core.Domain/Common/CommonDocument.cs index 96c120142..64c3df1cb 100644 --- a/IRaCIS.Core.Domain/Common/CommonDocument.cs +++ b/IRaCIS.Core.Domain/Common/CommonDocument.cs @@ -13,7 +13,7 @@ namespace IRaCIS.Core.Domain.Models ///CommonDocument /// [Table("CommonDocument")] - public class CommonDocument : Entity, IAuditUpdate, IAuditAdd + public class CommonDocument : Entity, IAuditUpdate, IAuditAdd,ISoftDelete { @@ -65,10 +65,12 @@ namespace IRaCIS.Core.Domain.Models /// [Required] public bool IsDeleted { get; set; } - + + public DateTime? DeletedTime { get; set; } + /// - /// Code - /// + /// Code + /// [Required] public string Code { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs index 742760f54..ce5e62d0b 100644 --- a/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs +++ b/IRaCIS.Core.Infra.EFCore/Repository/Repository.cs @@ -250,7 +250,7 @@ namespace IRaCIS.Core.Infra.EFCore public async Task UpdateFromQueryAsync(Expression> where, Expression> updateFactory) { - return await _dbSet.Where(where).UpdateFromQueryAsync(updateFactory) > 0; + return await _dbSet.IgnoreQueryFilters().Where(where).UpdateFromQueryAsync(updateFactory) > 0; } #endregion