public PhotosService( IMapper mapper, PhotosRepository photosRepository ) { this._mapper = mapper; this._photosRepository = photosRepository; }
public List<PhotosModel> PhotosByParentId() { List<PhotosModel> Modelitems=new List<PhotosModel>(); List<Photos> items = new PhotosRepository().ShowPhotosByParentId(new Guid("59ef2601-e4e4-423e-8bb7-d5b1d589f028")); foreach (Photos item in items) { PhotosModel modelitem =ClassToModel( item); Modelitems.Add(modelitem); } return Modelitems; }
public UnitOfWork(DatabaseContext context) { _context = context ?? throw new ArgumentNullException(nameof(context)); Likes = new LikesRepository(_context); Messages = new MessagesRepository(_context); Photos = new PhotosRepository(_context); Users = new UsersRepository(_context); UserRoles = new UserRolesRepository(_context); }
public List <PhotosModel> PhotosByParentId() { List <PhotosModel> Modelitems = new List <PhotosModel>(); List <Photos> items = new PhotosRepository().ShowPhotosByParentId(new Guid("59ef2601-e4e4-423e-8bb7-d5b1d589f028")); foreach (Photos item in items) { PhotosModel modelitem = ClassToModel(item); Modelitems.Add(modelitem); } return(Modelitems); }
public PostsService(PostsRepository postsRepository, PhotosRepository photosRepository, ILogger <PostsService> logger) { _postsRepository = postsRepository; _photosRepository = photosRepository; _logger = logger; var cpuCount = Environment.ProcessorCount; _logger.LogInformation($"Cpu count = {cpuCount}"); _semaphore = new SemaphoreSlim(cpuCount, cpuCount); _eventsMap = new Dictionary <Guid, ProcessingEvents>(); }
public void Instance_Is_PropertyRepository_Of_PhotoOfAccommodation() { //Arrange var type = typeof(TravelRepository <Photo>); var contextMock = new Mock <TravelDbContext>(); //Act var repository = new PhotosRepository(contextMock.Object); //Assert Assert.IsInstanceOf(type, repository); }
public UnitOfWork(AppDbContext dbContext) { _dbContext = dbContext; Admins = new AdminsRepository(_dbContext); Albums = new AlbumsRepository(_dbContext); Messages = new MessagesRepository(_dbContext); Photos = new PhotosRepository(_dbContext); Sellers = new SellersRepository(_dbContext); Users = new UsersRepository(_dbContext); Reviews = new ReviewsRepository(_dbContext); }
public UtilityController( UsersRepository usersRepository, AlbumsRepository albumsRepository, PhotosRepository photosRepository, AlbumsService albumPreviewService ) { this._usersRepository = usersRepository; this._albumsRepository = albumsRepository; this._photosRepository = photosRepository; this._albumPreviewService = albumPreviewService; }
public Car GetById(int id) { var car = new CarRepository().GetById(id); if (car == null) { return(null); } var photosRepository = new PhotosRepository(); var photos = photosRepository.GetByCarId(car.Id); car.Photos = photos.Any() ? photos : null; return(car); }
public AlbumsService( IMapper mapper, UsersRepository usersRepository, AlbumsRepository albumsRepository, PhotosRepository photosRepository, IOptions <ApplicationSettings> applicationSettings ) { this._mapper = mapper; this._usersRepository = usersRepository; this._albumsRepository = albumsRepository; this._photosRepository = photosRepository; this._applicationSettings = applicationSettings; this._client = new MongoClient(this._applicationSettings.Value.MongoDbSettings.ConnectionString); this._database = this._client.GetDatabase(this._applicationSettings.Value.MongoDbSettings.DatabaseName); this._albumPreviewCollection = this._database.GetCollection <AlbumPreview>(this._applicationSettings.Value.MongoDbSettings.AlbumPreviewCollection); }
public List <Car> GetCars(Filters filters) { var cars = new CarRepository().GetAll().ByFilters(filters); if (!cars.Any()) { return(cars); } var photosRepository = new PhotosRepository(); foreach (var car in cars) { var photos = photosRepository.GetByCarId(car.Id); car.Photos = photos.Any() ? photos : null; } return(cars); }
public long CreateCar(Car car) { var carRepository = new CarRepository(); var carId = carRepository.AddCar(car); if (car.Photos == null || !car.Photos.Any()) { return(carId); } var photosRepository = new PhotosRepository(); foreach (var imageFile in car.Photos) { photosRepository.AddPhoto(imageFile, carId); } return(carId); }
public UnitOfWork(DataContext context) { _context = context; Users = new UsersRepository(_context); Photos = new PhotosRepository(_context); Groups = new GroupsRepository(_context); Memberships = new MembershipsRepository(_context); Auths = new AuthRepository(_context); Comments = new CommentsRepository(_context); Achievements = new AchievementsRepository(_context); Cities = new CitiesRepository(_context); Countries = new CountriesRepository(_context); Locations = new LocationsRepository(_context); Matchdays = new MatchdaysRepository(_context); MatchStatuses = new MatchStatusesRepository(_context); Friends = new FriendsRepository(_context); Messages = new MessagesRepository(_context); Chats = new ChatsRepository(_context); }
private static async void BuiltInStorageTests(List <PublicTopic> firstTopics) { PhotosRepository repo = new PhotosRepository(); var topicNames = firstTopics.Select(x => x.Title); Parallel.Invoke( () => { if (!TheAppContext.IsTravisCI) { repo.CreateTopics(topicNames); } }, () => { /* * Parallel.ForEach(topicsWithBlobs, (topicWithBlobs) => * { * var idContentList = topicWithBlobs.Blobs.Select(x => x.IdContent).ToList(); * repo.CreateContent(idContentList); * Console.WriteLine($"Saved {idContentList.Count} related blobs of Topic: {topicWithBlobs.Title}"); * }); */ }); var topics = new[] { "One Topic", "Another Topic" }; var totalActions = new List <Action>(); foreach (var topic_ in topics) { var topic = topic_; Action[] actions = new Action[] { () => repo.AddUserAction(topic, "Tester", "Disliked-content", UserAction.Dislike), () => repo.AddUserAction(topic, "Tester", "Liked-content", UserAction.Like), () => repo.AddUserAction(topic, "Another Tester", "Liked-content", UserAction.Like), () => repo.AddUserAction(topic, "Tester", "Starred-content", UserAction.Star), () => repo.AddUserAction(topic, "Tester", "Shared-content", UserAction.Share), () => { repo.AddUserAction(topic, "Tester", "Double-Liked-content", UserAction.Like); repo.AddUserAction(topic, "Tester", "Double-Liked-content", UserAction.Like); }, () => { repo.AddUserAction(topic, "Tester", "Liked-and-then-Disliked-content", UserAction.Like); repo.AddUserAction(topic, "Tester", "Liked-and-then-Disliked-content", UserAction.Dislike); }, () => { repo.AddUserAction(topic, "Tester", "Disliked-and-then-Liked-content", UserAction.Dislike); repo.AddUserAction(topic, "Tester", "Disliked-and-then-Liked-content", UserAction.Like); }, }; totalActions.AddRange(actions); } var numThreads = totalActions.Count; ParallelOptions opts = new ParallelOptions() { MaxDegreeOfParallelism = numThreads }; Parallel.ForEach(totalActions, opts, (a) => { try { a(); } catch { } }); try { repo.GetUserPhotosByTopic("One Topic", "Tester"); Stopwatch sw = Stopwatch.StartNew(); var byUser = await repo.GetUserPhotosByTopic("One Topic", "Tester"); Console.WriteLine($"Marks retrieved in {sw.Elapsed}:"); foreach (var userPhoto in byUser) { Console.WriteLine(" " + userPhoto.Value.ToDebugString()); } } catch (Exception ex) { Console.WriteLine("TEST FAILED: repo.GetUserPhotosByTopic(\"One Topic\", \"Tester\");"); Console.WriteLine(ex); } }
public ActionController(PhotosRepository photosRepository, ContentManager contentManager) { _photosRepository = photosRepository; _ContentManager = contentManager; }
public HomeController(ILogger <GalleryController> logger, ContentManager contentManager, PhotosRepository photosRepository) { _Logger = logger; _ContentManager = contentManager; _PhotosRepository = photosRepository; }
public PhotosController(PhotosRepository photosRepository) { this.photosRepository = photosRepository; }