public async Task <Result <BloodRequestDto> > Handle(CreateBloodRequest request, CancellationToken cancellationToken)
        {
            var openIdResult = await _currentUser.GetOpenIdUser();

            var result = await _bloodRequestRepository.CreateAsync(BloodRequest.Create(request, openIdResult.Value.Id));

            await _mediator.Publish(new SendEmailNotification(new List <MailboxAddress> {
                new(openIdResult.Value.NickName, openIdResult.Value.EmailAddress)
            }, "New Request Created [Blood]", $"Request for blood is created.<br/> Request ID: {result.Id}"), cancellationToken);
Пример #2
0
        public static BloodRequest Create(CreateBloodRequest dto, OpenIdKey openIdKey)
        {
            var result = new BloodRequest
            {
                OpenIdKey       = openIdKey,
                BloodGroup      = dto.BloodGroup,
                DonationType    = dto.DonationType,
                PatientName     = dto.PatientName,
                Priority        = dto.Priority,
                QuantityInUnits = dto.QuantityInUnits,
                Reason          = dto.Reason,
                Status          = DetailedStatusList.Open,
                Id = Guid.NewGuid()
            };

            return(result);
        }