Пример #1
0
        public async Task <FeaturedSchoolingEventViewModel> GetById(Guid id)
        {
            var entity = await _schoolingEventRepository.GetById(id);

            if (entity == null)
            {
                await _bus.RaiseEvent(new DomainNotification("GetById", $"Event with id {id} doesn't exist"));

                return(null);
            }

            var vm = Mapper.Map <FeaturedSchoolingEventViewModel>(entity);

            if (_user.IsAuthenticated())
            {
                var currentUserId = _user.Id;
                vm.IsFollowing = await _schoolingEventRepository.IsUserFollowingEvent(currentUserId, entity.Id);

                vm.HasCreated = vm.CreatedByUserId == _user.Id;
            }

            return(vm);
        }