Refactor RecordAsync object initialization

Updated the `RecordAsync` method in the `EnvelopeHistoryService` class to use an explicit object initializer with braces for creating a new object in the `CreateAsync` method. This change improves code clarity while maintaining the same functionality.
This commit is contained in:
Developer 02 2025-05-13 11:21:01 +02:00
parent 7e66cd4dae
commit bc45aadf27

View File

@ -76,7 +76,14 @@ public class EnvelopeHistoryService : CRUDService<IEnvelopeHistoryRepository, En
}
public async Task<DataResult<long>> RecordAsync(int envelopeId, string userReference, EnvelopeStatus status, string? comment = null) =>
await CreateAsync(new (EnvelopeId: envelopeId, UserReference: userReference, Status: (int)status, ActionDate: DateTime.Now, Comment: comment))
await CreateAsync(new ()
{
EnvelopeId = envelopeId,
UserReference = userReference,
Status = (int) status,
ActionDate = DateTime.Now,
Comment = comment
})
.ThenAsync(
Success: id => Result.Success(id),
Fail: (mssg, ntc) => Result.Fail<long>().Message(mssg).Notice(ntc)