Exemplo n.º 1
0
        public ActionResult Dodaj(int nppId)
        {
            PredmetUrediVM model = new PredmetUrediVM
            {
                NppId = nppId,
                GodinaStudijaStavke = GodinaStudijaStavke()
            };

            return(View("Uredi", model));
        }
Exemplo n.º 2
0
        public ActionResult Dodaj(int nppId)
        {
            NPP npp = ctx.NPPs.Where(x => x.Id == nppId)
                      .Include(x => x.Smjer.Fakultet)
                      .Include(x => x.AkademskaGodina)
                      .Single();

            PredmetUrediVM model = new PredmetUrediVM
            {
                FakultetNaziv       = npp.Smjer.Fakultet.Naziv,
                SmjerNaziv          = npp.Smjer.Naziv,
                NppNaziv            = npp.AkademskaGodina.Opis + ": " + npp.Naziv,
                NppId               = npp.Id,
                GodinaStudijaStavke = GodinaStudijaStavke()
            };

            return(View("Uredi", model));
        }
Exemplo n.º 3
0
        public ActionResult Uredi(int predmetId)
        {
            Predmet entity = ctx.Predmets.Where(x => x.Id == predmetId)
                             .Include(x => x.Npp.Odsjek.Fakultet)
                             .Include(x => x.Npp.AkademskaGodina)
                             .Single();

            PredmetUrediVM model = new PredmetUrediVM
            {
                Id            = entity.Id,
                PredmetNaziv  = entity.Naziv,
                Ects          = entity.Ects,
                GodinaStudija = entity.GodinaStudija,

                NppId = entity.Npp.Id,
                GodinaStudijaStavke = GodinaStudijaStavke()
            };

            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult Snimi(PredmetUrediVM input)
        {
            Predmet entity;

            if (input.Id == 0)
            {
                entity = new Predmet();
                ctx.Predmets.Add(entity);
            }
            else
            {
                entity = ctx.Predmets.Find(input.Id);
            }
            entity.Naziv         = input.PredmetNaziv;
            entity.NppId         = input.NppId;
            entity.GodinaStudija = input.GodinaStudija;
            entity.Ects          = input.Ects;

            ctx.SaveChanges();

            return(RedirectToAction("Index", new { nppId = entity.NppId }));
        }