Esempio n. 1
0
        /// <summary>
        /// Loads the content.
        /// </summary>
        public void LoadContent()
        {
            string          levelsPath      = Path.Combine(ApplicationPaths.DataDirectory, "levels.xml");
            LevelRepository levelRepository = new LevelRepository(levelsPath);

            levels = levelRepository.GetAll().ToDomainModels().ToList();

            level = levels.FirstOrDefault(x => x.Id == "test"); // TODO: Remove test data
        }
Esempio n. 2
0
        public List <SelectListItem> GetRegionsByClient(List <int?> ClientIds)
        {
            ILevelRepository      levelRepo  = new LevelRepository();
            List <SelectListItem> regionList = new List <SelectListItem>();

            regionList = levelRepo.GetAll().Where(x => ClientIds.Contains(x.ClientID) && !string.IsNullOrEmpty(x.Name)).Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.ID.ToString()
            }
                                                                                                                               ).ToList();
            return(regionList);
        }
Esempio n. 3
0
        public List <SelectListItem> GetAllRegions()
        {
            ILevelRepository      levelRepo  = new LevelRepository();
            List <SelectListItem> regionList = new List <SelectListItem>();

            regionList = levelRepo.GetAll().Where(x => !string.IsNullOrEmpty(x.Name)).Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.ID.ToString()
            }
                                                                                             ).ToList();
            return(regionList);
        }
Esempio n. 4
0
        //
        // GET: /Admin/ImportExcel/

        public ActionResult Index()
        {
            ViewBag.DefaultBranchId = UserContext.GetDefaultBranch();
            ViewBag.Collectors      = CollectorRepository.GetAll();
            ViewBag.Channels        = ChannelRepository.GetAll();
            ViewBag.SourceTypes     = SourceTypeRepository.GetAll();
            var levels = LevelRepository.GetAll();
            var L1n2   = levels.Where(x => x.LevelId < 3).ToList();

            ViewBag.Levels   = L1n2;
            ViewBag.Branches = BranchRepository.GetAll();
            return(View());
        }
Esempio n. 5
0
        public void GetAll_ShouldWork()
        {
            var context = _contextFake
                          .GetContext("GetAll_ShouldWork")
                          .AddFakeLevels();

            var levelsFind = context.Levels.ToList();

            var repo   = new LevelRepository(context);
            var result = repo.GetAll();

            Assert.NotNull(result);
            Assert.Equal(levelsFind, result, new LevelComparer());
        }
        public void Should_Return_All_Level_In_Db()
        {
            var fakeContext = new FakeContext("GetAllLevel");

            fakeContext.FillWith <Level>();

            using (var context = new MainContext(fakeContext.FakeOptions))
            {
                var levelCountIndDb = context.Level.Count();
                var repository      = new LevelRepository(context);

                Assert.Equal(levelCountIndDb, repository.GetAll().Count());
                repository.Dispose();
            }
        }
Esempio n. 7
0
        public void ShouldGetAll()
        {
            var fakeContext = new FakeContext("LevelGetAll");

            fakeContext.FillWith <Level>();

            using (var context = new CentralErrosContext(fakeContext.FakeOptions))
            {
                var expected = fakeContext.GetFakeData <Level>();

                var service = new LevelRepository(context);
                var actual  = service.GetAll();

                Assert.Equal(expected, actual, new LevelComparer());
            }
        }
Esempio n. 8
0
 // GET api/<controller>
 public IEnumerable <LevelInfo> Get()
 {
     return(LevelRepository.GetAll());
 }
Esempio n. 9
0
 public ActionResult <OkResponse <IEnumerable <LevelDto> > > GetAllLevels()
 {
     return(new OkResponse <IEnumerable <LevelDto> >(levelRepository.GetAll()));
 }