public ActionResult Obrisi(int angaziranNaPredmetId) { AngaziranNaPredmet x = ctx.AngaziranNaPredmets.Find(angaziranNaPredmetId); ctx.AngaziranNaPredmets.Remove(x); ctx.SaveChanges(); return(RedirectToAction("Index", new { izvodjenjePredmetaId = x.IzvodjenjePredmetaId })); }
public ActionResult Uredi(int angaziranNaPredmetId) { AngaziranNaPredmet angaziranNaPredmet = ctx.AngaziranNaPredmets .Where(x => x.Id == angaziranNaPredmetId) .Include(x => x.IzvodjenjePredmeta.Predmet.Npp.Odsjek.Fakultet) .Single(); AngaziranNaPredmetuUrediVM Model = new AngaziranNaPredmetuUrediVM { Id = angaziranNaPredmet.Id, IzvodjenjePredmetaId = angaziranNaPredmet.IzvodjenjePredmetaId, AngaziranNaPredmetTipStavke = AngaziranNaPredmetTipStavke(), NastavnoOsobljeStavke = NastavnoOsobljeStavke(), AngaziranNaPredmetTip = angaziranNaPredmet.AngaziranNaPredmetTip, NastavnoOsobljeId = angaziranNaPredmet.NastavnoOsobljeId }; return(View(Model)); }
public ActionResult Snimi(AngaziranNaPredmetuUrediVM input) { AngaziranNaPredmet entity; if (input.Id == 0) { entity = new AngaziranNaPredmet(); ctx.AngaziranNaPredmets.Add(entity); } else { entity = ctx.AngaziranNaPredmets.Find(input.Id); } entity.AngaziranNaPredmetTip = input.AngaziranNaPredmetTip.Value; entity.NastavnoOsobljeId = input.NastavnoOsobljeId.Value; entity.IzvodjenjePredmetaId = input.IzvodjenjePredmetaId; ctx.SaveChanges(); return(RedirectToAction("Index", new { izvodjenjePredmetaId = input.IzvodjenjePredmetaId })); }