Exemple #1
0
        private void UpdateLastBloodNotificationDonatorUser(Guid donatorUserId)
        {
            var donatorUser = _donatorUserRepository.GetById(donatorUserId);

            donatorUser.AddLastBloodNotification();
            _donatorUserRepository.Update(donatorUser);
        }
        public async Task <ICommandResult> Handle(UpdateDonatorUserCommand command, CancellationToken cancellationToken)
        {
            var donatorUser = _donatorUserRepository.GetById(command.Id);

            donatorUser.AddCellPhone(command.CellPhone);

            _donatorUserRepository.Update(donatorUser);

            DeleteUserSocialNotificationTypes(donatorUser.UserId);
            AddUserSocialNotificationTypes(donatorUser.UserId, command.SocialNotificationTypesId);

            Commit();

            return(await CompletedTask(donatorUser));
        }
        public IActionResult GetDonatorUserAccount(Guid donatorUserId)
        {
            UserAccountQuery userAccount = null;
            var donatorUser = _donatorUserRepository.GetById(donatorUserId);

            if (donatorUser != null)
            {
                var userSocialNotificationCodes = _userSocialNotificationTypeRepository.GetUserSocialNotificationTypeCode(donatorUser.UserId);
                userAccount = new UserAccountQuery()
                {
                    ActivedBloodNotification = donatorUser.ActivedBloodNotification,
                    ActivedHairNotification  = donatorUser.ActivedHairNotification,
                    CellPhone                   = donatorUser.CellPhone,
                    LastDonatedBlood            = donatorUser.LastDonatedBlood,
                    LastDonatedHair             = donatorUser.LastDonatedHair,
                    SocialNotificationTypeCodes = userSocialNotificationCodes
                };
            }
            ;

            return(Response(userAccount));
        }