コード例 #1
0
        public IActionResult Index()
        {
            KorisnickiNalog korisnik = HttpContext.GetLogiraniKorisnik();

            if (korisnik == null)
            {
                TempData["error_poruka"] = "Nemate pravo pristupa";
                return(RedirectToAction("Index", "Autentifikacija", new { area = "" }));
            }
            AdministratorIndexVM model = new AdministratorIndexVM
            {
                rowsA = _context.Administrators
                        .Select(x => new AdministratorIndexVM.RowA
                {
                    AdministratorId = x.AdministratorId,
                    KorisnickoIme   = x.KorisnickiNalog.KorisnickoIme,
                    Lozinka         = x.KorisnickiNalog.Lozinka,
                    Ime             = x.Ime,
                    Prezime         = x.Prezime,
                    JMBG            = x.JMBG,
                    Adresa          = x.Adresa,

                    Telefon               = x.Telefon,
                    Email                 = x.Email,
                    ItCertifikat          = x.ITCertifikat,
                    IzjavaZastitaPodataka = x.IzjavaZastitaPodataka,
                    Grad   = x.Grad.NazivGrada,
                    Drzava = x.Drzava.NazivDrzave
                }).ToList()
            };

            return(View("Index", model));
        }
コード例 #2
0
        public IActionResult Index()
        {
            AdministratorIndexVM model = new AdministratorIndexVM();



            //Info o nalozima
            model.trenutnoKorisnika  = _db.Klijenti.Count();
            model.administratora     = _db.Administratori.Count();
            model.trenutnoKnjiga     = _db.EKnjige.Count();
            model.trenutnoPrijedloga = _db.PrijedlogKnjiga.Count();
            model.prodanoKnjiga      = _db.KupovinaKnjiga.Count();



            return(View(model));
        }
コード例 #3
0
        public IActionResult Index()
        {
            var administrators  = db.Administrator.ToList();
            var administratorVm = new List <AdministratorIndexVM>();

            foreach (var administrator in administrators)
            {
                var administratorInput = new AdministratorIndexVM()
                {
                    Id                = administrator.Id,
                    FullName          = administrator.FName + " " + administrator.LName,
                    UserName          = db.ProfileInfo.FirstOrDefault(x => x.Id == administrator.ProfileInfoId).Username,
                    DateAdded         = administrator.DateAdded.ToString(),
                    AdministratorRole = db.AdministrastorRole.FirstOrDefault(x => x.Id == administrator.AdministrastorRoleId).Name,
                    AdministratorCity = db.City.FirstOrDefault(x => x.Id == administrator.CityId).Name,
                    Email             = db.Contact.FirstOrDefault(x => x.Id == administrator.ContactInfoId).Email,
                    Phone             = db.Contact.FirstOrDefault(x => x.Id == administrator.ContactInfoId).Phone
                };

                administratorVm.Add(administratorInput);
            }
            ;
            return(View(administratorVm));
        }