public async Task <IActionResult> Edit(int id, [Bind("Naziv,Proizvodjac,Cijena,VrstaPrikljucka,DuzinaKabla,DodatneTipke,Id")] Mis mis)
        {
            if (id != mis.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(mis);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MisExists(mis.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(mis));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Naziv,Proizvodjac,Cijena,Zapremina,BrojPortova,Id")] Kuciste kuciste)
        {
            if (id != kuciste.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(kuciste);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KucisteExists(kuciste.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(kuciste));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Ime,Prezime,KorisnickoIme,Email,Adresa,Sifra,DatumRodjenja")] Korisnik korisnik)
        {
            if (id != korisnik.KorisnikId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(korisnik);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KorisnikExists(korisnik.KorisnikId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(korisnik));
        }
Exemple #4
0
        public async Task <IActionResult> Edit(int id, Student student)
        {
            if (id != student.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    if (student.Ime == "Dzavid")
                    {
                        RedirectToAction("Privacy", "Home", new { prezime = "Brdar" });
                    }
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
Exemple #5
0
        public async Task <IActionResult> Edit(int id, [Bind("Naziv,Proizvodjac,Cijena,Slika")] Proizvod proizvod)
        {
            if (id != proizvod.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(proizvod);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProizvodExists(proizvod.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(proizvod));
        }
        public async Task <IActionResult> Edit(int id, [Bind("UpisNaPredmetId,PredmetId,StudentId,Ocjena")] UpisNaPredmet upisNaPredmet)
        {
            if (id != upisNaPredmet.UpisNaPredmetId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(upisNaPredmet);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UpisNaPredmetExists(upisNaPredmet.UpisNaPredmetId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["PredmetId"] = new SelectList(_context.Predmet, "PredmetId", "PredmetId", upisNaPredmet.PredmetId);
            ViewData["StudentId"] = new SelectList(_context.Student, "ID", "ID", upisNaPredmet.StudentId);
            return(View(upisNaPredmet));
        }
Exemple #7
0
        public async Task <IActionResult> Edit(int id, [Bind("DatumTransakcije,Iznos")] Kupovina kupovina)
        {
            if (id != kupovina.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(kupovina);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KupovinaExists(kupovina.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(kupovina));
        }
        public async Task <IActionResult> Edit(int id, [Bind("PredmetId,Naziv,ETCS")] Predmet predmet)
        {
            if (id != predmet.PredmetId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(predmet);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PredmetExists(predmet.PredmetId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(predmet));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Naziv,Proizvodjac,Cijena,VrstaPrikljucka,Id")] Tastatura tastatura)
        {
            if (id != tastatura.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tastatura);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TastaturaExists(tastatura.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tastatura));
        }
        public async Task <IActionResult> Edit(int id, [Bind("ProizvodId,KupovinaId")] KupovinaProizvoda kupovinaProizvoda)
        {
            if (id != kupovinaProizvoda.ProizvodId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(kupovinaProizvoda);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!KupovinaProizvodaExists(kupovinaProizvoda.ProizvodId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["KupovinaId"] = new SelectList(_context.Kupovina, "Id", "Id", kupovinaProizvoda.KupovinaId);
            ViewData["ProizvodId"] = new SelectList(_context.Proizvod, "Id", "Naziv", kupovinaProizvoda.ProizvodId);
            return(View(kupovinaProizvoda));
        }
Exemple #11
0
        public async Task <IActionResult> Edit(int id, [Bind("Naziv,Proizvodjac,Cijena,KolicinaMemorije,BrojVentilatora")] GrafickaKartica grafickaKartica)
        {
            if (id != grafickaKartica.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(grafickaKartica);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GrafickaKarticaExists(grafickaKartica.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(grafickaKartica));
        }
Exemple #12
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Ime,Prezime")] Student student)
        {
            if (id != student.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(student);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StudentExists(student.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(student));
        }
Exemple #13
0
        public async Task <IActionResult> Edit(int id, [Bind("Naziv,Proizvodjac,Cijena,BrojRAMSlotova,SocketProcesora,Id")] MaticnaPloca maticnaPloca)
        {
            if (id != maticnaPloca.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(maticnaPloca);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MaticnaPlocaExists(maticnaPloca.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(maticnaPloca));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Naziv,Proizvodjac,Cijena,Kapacitet,Brzina,Id")] HardDisk hardDisk)
        {
            if (id != hardDisk.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hardDisk);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HardDiskExists(hardDisk.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hardDisk));
        }
        public async Task <IActionResult> Edit(int id, [Bind("")] Administrator administrator)
        {
            if (id != administrator.AdministratorId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(administrator);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AdministratorExists(administrator.AdministratorId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(administrator));
        }
Exemple #16
0
        public async Task <IActionResult> Edit(int id, [Bind("Kapacitet,Brzina")] Disk disk)
        {
            if (id != disk.DiskId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(disk);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DiskExists(disk.DiskId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(disk));
        }
        public async Task <IActionResult> Edit(int id, [Bind("Naziv,Proizvodjac,Cijena,Dijagonala,Rezolucija,BrojHDMI,BrojVGA,Id")] Monitor monitor)
        {
            if (id != monitor.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(monitor);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MonitorExists(monitor.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(monitor));
        }
        public async Task <IActionResult> Edit(int id, [Bind("DatumZaposljenja")] Uposlenik uposlenik)
        {
            if (id != uposlenik.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(uposlenik);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UposlenikExists(uposlenik.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(uposlenik));
        }
        public async Task UrediStanjeRacuna(Racun racun)
        {
            var racun1 = await _context.Racun.Include("Klijent").Where(m => m.Id == racun.Id).FirstAsync();

            racun1.StanjeRacuna = racun.StanjeRacuna;
            _context.Update(racun1);
            await _context.SaveChangesAsync();
        }
        public async Task <List <Kredit> > DajSveKredite()
        {
            var krediti = await _context.Kredit.Include("Racun").Include(c => c.Racun.Klijent).ToListAsync();

            foreach (Kredit k in krediti)
            {
                if (k.StatusKredita == StatusKredita.Aktivan && k.PocetakOtplate.Add(TimeSpan.FromDays((int)k.RokOtplate * 365)) < DateTime.Now)
                {
                    k.StatusKredita = StatusKredita.Zavrsen;
                    _context.Update(k);
                }
            }
            await _context.SaveChangesAsync();

            return(krediti);
        }
Exemple #21
0
 public async Task UrediBankara(Bankar bankar)
 {
     _context.Update(bankar);
     await _context.SaveChangesAsync();
 }
Exemple #22
0
 public async Task UrediKlijenta(Klijent klijent)
 {
     _context.Update(klijent);
     await _context.SaveChangesAsync();
 }
 public async Task UrediNovost(Novost novost)
 {
     _context.Update(novost);
     await _context.SaveChangesAsync();
 }
Exemple #24
0
 public async Task UrediBankomat(Bankomat bankomat)
 {
     _context.Update(bankomat);
     await _context.SaveChangesAsync();
 }