Skip to content

Commit

Permalink
[Bugfix][Duy] Fix bug when deleting contract
Browse files Browse the repository at this point in the history
  • Loading branch information
duykasama committed Mar 19, 2024
1 parent 5cd13d5 commit 4d674a3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Domus.Service/Implementations/ContractService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,10 @@ public async Task<ServiceActionResult> UpdateContract(ContractRequest request, G
contract.Signature = request.Signature ?? contract.Signature;
contract.ClientId = request.ClientId;
contract.ContractorId = request.ContractorId;

await _contractRepository.UpdateAsync(contract);
await _unitOfWork.CommitAsync();




return new ServiceActionResult(true);
}

Expand All @@ -169,8 +167,9 @@ public async Task<ServiceActionResult> DeleteContract(Guid ContractId)
await _notificationRepository.AddAsync(new Notification()
{
RecipientId = contract.ClientId,
Image = contract.Contractor.ProfileImage,
Content = NotificationHelper.CreateDeletedContractMessage(ContractId, (contract.Contractor.FullName.Equals("N/A")) ? contract.Contractor.Email : contract.Contractor.FullName),
Image = contract.Contractor.ProfileImage ?? string.Empty,
Content = NotificationHelper.CreateDeletedContractMessage(ContractId, (contract.Contractor.FullName.Equals("N/A")) ? contract.Contractor.Email! : contract.Contractor.FullName),
SentAt = DateTime.Now.AddHours(7)
});
await _unitOfWork.CommitAsync();
return new ServiceActionResult(true);
Expand Down Expand Up @@ -404,4 +403,4 @@ private async Task ValidateContractRequest(ContractRequest request)
if (!contractorRoles.Contains(UserRoleConstants.STAFF))
throw new UnauthorizedAccessException($"Unauthorized ContractorId: {request.ContractorId}");
}
}
}

0 comments on commit 4d674a3

Please sign in to comment.