Beispiel #1
0
        public async Task <bool> Handle(UpdatePersonalAvatarCommand request, CancellationToken cancellationToken)
        {
            var person = await _personalRepository.GetPersonalByEmailAsync(request.Email);

            if (person == null)
            {
                return(false);
            }

            person.UpdatePersonalAvatar(request.Avatar);
            await _personalRepository.UpdateAsync(person);

            return(await _personalRepository.UnitOfWork.SaveEntitiesAsync());
        }
        public async Task <bool> Handle(UpdatePersonalInfoCommand request, CancellationToken cancellationToken)
        {
            var person = await _personalRepository.GetPersonalByEmailAsync(request.Email);

            if (person == null)
            {
                return(false);
            }
            var address  = new Address(request.Street, request.City, request.Province);
            var birthday = new Birthday(request.Year, request.Month, request.Day);

            person.UpdatePersonalInfo(request.UserName, request.Gender, address, birthday);
            await _personalRepository.UpdateAsync(person);

            return(await _personalRepository.UnitOfWork.SaveEntitiesAsync());
        }
Beispiel #3
0
        public async Task <List <TeamMember> > Handle(TeamMembersQuery request, CancellationToken cancellationToken)
        {
            var members = await _teamRepository.QueryMembersAsync(request.TeamId);

            var result = new List <TeamMember>();

            members.ForEach(async m =>
            {
                var peroson = await _personalRepository.GetPersonalByEmailAsync(m.Email);
                result.Add(new TeamMember()
                {
                    TeamId   = m.TeamId,
                    Email    = m.Email,
                    Name     = peroson.UserName,
                    Avatar   = peroson.Avatar,
                    IsLeader = m.IsLeader
                });
            });
            return(result);
        }
Beispiel #4
0
        public async Task <Personal> Handle(PersonalInfoQuery request, CancellationToken cancellationToken)
        {
            var personal = await _personalRepository.GetPersonalByEmailAsync(request.Email);

            if (personal == null)
            {
                return(null);
            }

            return(new Personal()
            {
                UserName = personal.UserName,
                Gender = personal.Gender,
                Province = personal.Address?.Province,
                City = personal.Address?.City,
                Street = personal.Address?.Street,
                Email = personal.Email,
                Avatar = personal.Avatar,
                Year = personal.Birthday.Year,
                Month = personal.Birthday.Month,
                Day = personal.Birthday.Day
            });
        }