Beispiel #1
0
        public IActionResult Index()
        {
            RadniciIndexViewModel model = new RadniciIndexViewModel();

            model.Radnici = db.Radnici.Include(p => p.Pozicija).Include(o => o.Osoba).ThenInclude(g => g.Grad).ToList();

            return(View(model));
        }
Beispiel #2
0
        public IActionResult Pretraga(string srchTxt)
        {
            if (srchTxt == null)
            {
                return(RedirectToAction(nameof(Index)));
            }

            RadniciIndexViewModel model = new RadniciIndexViewModel();

            model.Radnici = db.Radnici.Include(p => p.Pozicija).Include(o => o.Osoba).ThenInclude(g => g.Grad).Where(x => (x.Osoba.Ime + " " + x.Osoba.Prezime).StartsWith(srchTxt) || (x.Osoba.Prezime + " " + x.Osoba.Ime).StartsWith(srchTxt)).ToList();

            model.srchTxt = srchTxt;

            return(View("Index", model));
        }