Beispiel #1
0
        public async Task <IEnumerable <SalaViewModel> > ObterTodos([FromUri] int skip)
        {
            var query = new SalaListQuery {
                Skip = skip
            };

            return(await _handler.Query <SalaListQuery, IEnumerable <SalaViewModel> >(query));
        }
Beispiel #2
0
        public async Task <OperationResultVo> GetMyMentors(Guid currentUserId)
        {
            try
            {
                IEnumerable <Guid> mentors = await mediator.Query <GetMentorsByUserIdQuery, IEnumerable <Guid> >(new GetMentorsByUserIdQuery(currentUserId));

                List <ProfileViewModel> finalList = new List <ProfileViewModel>();

                foreach (Guid mentorId in mentors)
                {
                    if (!finalList.Any(x => x.UserId == mentorId))
                    {
                        UserProfile profile = GetCachedProfileByUserId(mentorId);

                        if (profile != null)
                        {
                            ProfileViewModel vm = mapper.Map <ProfileViewModel>(profile);

                            vm.ProfileImageUrl = UrlFormatter.ProfileImage(vm.UserId, 84);
                            vm.CoverImageUrl   = UrlFormatter.ProfileCoverImage(vm.UserId, vm.Id, vm.LastUpdateDate, profile.HasCoverImage, 300);

                            finalList.Add(vm);
                        }
                    }
                }

                return(new OperationResultListVo <ProfileViewModel>(finalList));
            }
            catch (Exception ex)
            {
                return(new OperationResultVo(ex.Message));
            }
        }