public LandmarksController() { _dbContext = new ApplicationDbContext(); _landmarkGenerator = new LandmarkGenerator(); _landmarkRepository = new LandmarkRepository(_dbContext); _locationRepository = new LocationRepository(_dbContext); }
public BusinessLayerTests() { var options = SqliteInMemory.CreateOptions <ApplicationContext>(); context = new ApplicationContext(options); context.Database.EnsureCreated(); // Seed Inventory content context.SeedItemTypes(); context.SeedItemImages(); // Seed Monster content context.SeedMonsterModels(); context.SeedMonsterNames(); context.SeedMonsterTitles(); inventoryRepository = new InventoryRepository(context); inventoryService = new InventoryService(inventoryRepository); playerRepository = new PlayerRepository(context); playerService = new PlayerService(playerRepository); monsterRepository = new MonsterRepository(context); monsterService = new MonsterService(monsterRepository); knightRepository = new KnightRepository(context); landmarkRepository = new LandmarkRepository(context); landmarkService = new LandmarkService(landmarkRepository, knightRepository); }
public LandmarkModel GetLandmark(int id, string imageFolderPath) { using (LandmarkRepository repo = new LandmarkRepository()) { var landmark = repo.Read(id); var data = new LandmarkModel(landmark); data.FLargeUrl = Helper.ToBase64String(imageFolderPath, landmark.FLargeUrl); data.FThumbnailUrl = Helper.ToBase64String(imageFolderPath, landmark.FThumbnailUrl); return(data); } }
protected virtual void Dispose(bool disposing) { if (disposing) { LandmarkRepository.Dispose(); LpcLamppostRepository.Dispose(); LpcLocationRepository.Dispose(); LpcReportRepository.Dispose(); PlutoRepository.Dispose(); DbContext.Dispose(); } }
public List <LandmarkModel> GetLocationLandmarks(int id, string imageFolderPath) { using (LandmarkRepository repo = new LandmarkRepository()) { var data = repo.List(id); data.ForEach(l => { l.FLargeUrl = Helper.ToBase64String(imageFolderPath, l.FLargeUrl); l.FThumbnailUrl = Helper.ToBase64String(imageFolderPath, l.FThumbnailUrl); }); return(data.Select(l => new LandmarkModel(l)).ToList()); } }
public LandmarkService(LandmarkRepository landmarkRepository, KnightRepository knightRepository) { this.landmarkRepo = landmarkRepository; this.knightRepo = knightRepository; }