示例#1
0
        public IActionResult Index()
        {
            Zaposlenik k = HttpContext.GetLogiraniKorisnik();

            if (k == null || k.isCistacica == false)
            {
                TempData["error_poruka"] = "nemate pravo pristupa";
                return(RedirectToAction("Index", "Autentifikacija", new { area = " " }));
            }

            ProizvodIndexVM model = new ProizvodIndexVM();

            model.Proizvodi = db.Proizvod.Select(x => new ProizvodIndexVM.Row
            {
                Naziv          = x.Naziv,
                Cijena         = x.Cijena,
                Vrsta          = x.Vrsta,
                MjernaJedinica = x.MjernaJedinica,
                ID             = x.Id
            }).ToList();



            return(View(model));
        }
示例#2
0
        public ActionResult Index()
        {
            List <ProizvodIndexVM.ProizvodInfo> Proizvodi = ctx.Proizvods.Select(x => new ProizvodIndexVM.ProizvodInfo
            {
                Id     = x.Id,
                Valid  = x.Valid,
                Naziv  = x.Naziv,
                Cijena = x.Cijena,
                Popust = x.Popust
            }).ToList();
            ProizvodIndexVM Model = new ProizvodIndexVM
            {
                ProizvodiList = Proizvodi
            };

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