// GET: Komentarz
        public ActionResult Index(string kod, string nazwa, bool?zkomentarzem, string producent)
        {
            filtr = new FiltrViewModel()
            {
                Kod              = kod,
                Nazwa            = nazwa,
                ZawieraKomentarz = zkomentarzem ?? false,
                Producent        = producent
            };

            var komentarze = komentarzMaganer.PobierzKomentarzeZBazy(filtr);

            return(View(komentarze.ToList()));
        }
Example #2
0
        // GET: Specialties
        public IActionResult Index(string nameSpecialty, int course, int semester, int page = 1)
        {
            IQueryable <Specialty> specialties = _context.Speciaties
                                                 .Include(o => o.Disciplins)
                                                 .Include(o => o.Pulpit);



            if (!String.IsNullOrEmpty(nameSpecialty))
            {
                specialties = specialties.Where(p => p.NameSpecialty.Contains(nameSpecialty));
            }

            if (course != 0)
            {
                specialties = specialties.Where(p => p.Course == course);
            }

            if (semester != 0)
            {
                specialties = specialties.Where(p => p.Semester == semester);
            }



            FiltrViewModel filtrViewModel = new FiltrViewModel(specialties, nameSpecialty, course, semester);

            int pageSize = 10;   // количество элементов на странице

            var source = specialties.ToList();
            var count  = source.Count();
            var items  = source.Skip((page - 1) * pageSize).Take(pageSize).ToList();

            PageViewModel  pageViewModel = new PageViewModel(count, page, pageSize);
            IndexViewModel viewModel     = new IndexViewModel
            {
                PageViewModel  = pageViewModel,
                FiltrViewModel = filtrViewModel,
                Specialties    = items
            };

            return(View(viewModel));

            /* var universityContext = _context.Speciaties.Include(s => s.Pulpit);
             * return View(await universityContext.ToListAsync());*/
        }
        public async Task <IActionResult> Index(string nameSpecialty, int course, int semester, int page = 1)
        {
            /* var universityContext = _context.Disciplins.Include(d => d.Specialty).Include(d => d.Teachers).Include(d => d.TypeOfDiscipline);
             *  return View(await universityContext.ToListAsync());*/


            IQueryable <Discipline> disciplines = _context.Disciplins
                                                  .Include(x => x.Teachers)
                                                  .Include(y => y.Specialty)
                                                  .Include(z => z.TypeOfDiscipline);

            if (!String.IsNullOrEmpty(nameSpecialty))
            {
                disciplines = disciplines.Where(p => p.Specialty.NameSpecialty.Contains(nameSpecialty));
            }

            if (course != 0)
            {
                disciplines = disciplines.Where(p => p.Specialty.Course == course);
            }

            if (semester != 0)
            {
                disciplines = disciplines.Where(p => p.Specialty.Semester == semester);
            }
            FiltrViewModel filtrViewModel = new FiltrViewModel(disciplines, nameSpecialty, course, semester);
            int            pageSize       = 10; // количество элементов на странице

            var source = disciplines.ToList();
            var count  = source.Count();
            var items  = source.Skip((page - 1) * pageSize).Take(pageSize).ToList();

            PageViewModel pageViewModel = new PageViewModel(count, page, pageSize);

            IndexViewModel viewModel = new IndexViewModel
            {
                PageViewModel  = pageViewModel,
                FiltrViewModel = filtrViewModel,
                Disciplines    = items
            };

            return(View(viewModel));
        }
Example #4
0
        public async Task <IActionResult> GetSamplePersonTest([FromBody] FiltrViewModel model)
        {
            //ResultViewModel result = new ResultViewModel
            //{
            //    Questions = await _dbContext.Questions.Where(p => p.TestId == model.TestId).ToListAsync(),
            //                //.Include(p => p.AnswerChoices).ToListAsync(),
            //    AnswerChoices = await _dbContext.AnswerChoices.Where(p=>p.SamplePersonId == model.SamplePersonId).ToListAsync()
            //};
            List <Question> result = new List <Question>();

            result = await _dbContext.Questions.Where(p => p.TestId == model.TestId).ToListAsync();

            foreach (var question in result)
            {
                question.AnswerChoices = await _dbContext.AnswerChoices.Where(p => p.SamplePersonId == model.SamplePersonId).ToListAsync();
            }
            return(PartialView("LookTests", result));
            //return Json(RedirectToAction("LookTests", "Filtr", new { model = result }));
        }
Example #5
0
 public FiltrKomentarzy(FiltrViewModel filtr)
 {
     vm = filtr;
 }
Example #6
0
 public IList <Produkt> PobierzKomentarzeZBazy(FiltrViewModel filtr)
 {
     filtrKomentarzy = new FiltrKomentarzy(filtr);
     return(filtrKomentarzy.ZwrocListeKomentarzyUzytkownikowi());
 }