Example #1
0
        public ObjectGetter(IRepository <int, OfferedObject> repository,
                            IPhotoUrlConstructor photoUrlConstructor,
                            IObjectImpressionsManager impressionsManager, ObjectQueryHelper queryHelper,
                            CurrentUserCredentialsGetter credentialsGetter, IConfiguration configs, IUserDataManager userDataManager)
        {
            _objectRepo        = repository;
            _photoConstructor  = photoUrlConstructor;
            _impressionManager = impressionsManager;
            _queryHelper       = queryHelper;

            ObjectDtoSelectExp = (o) => new ObjectDto
            {
                Id = o.OfferedObjectId,
                CountOfImpressions = o.Impressions.Count,
                CountOfViews       = 0,
                Description        = o.Description,
                Name    = o.Name,
                Rating  = null,
                OwnerId = o.OwnerLogin.UserId.ToString(),
                Photos  = o.Photos.Select(op => _photoConstructor.Construct(op)).ToList(),
                Tags    = o.Tags.Select(ot => ot.Tag.Name).ToList(),
                Type    = o.CurrentTransactionType,
            };
            _credentialsGetter = credentialsGetter;
            _configs           = configs;
            _userDataManager   = userDataManager;
        }
 public ObjectDetailsGetter(IRepository <int, OfferedObject> objectRepo,
                            IPhotoUrlConstructor photoConstructor,
                            IObjectViewsManager viewsManager,
                            ObjectQueryHelper queryHelper,
                            CurrentUserCredentialsGetter credentialsGetter)
 {
     _objectRepo        = objectRepo;
     _photoConstructor  = photoConstructor;
     _viewsManager      = viewsManager;
     _queryHelper       = queryHelper;
     _credentialsGetter = credentialsGetter;
 }