public void Remove(int id)
        {
            Podpredmet p = _context.Podpredmeti.Find(id);

            _context.Podpredmeti.Remove(p);
            _context.SaveChanges();
        }
Esempio n. 2
0
        public ActionResult Edit([Bind(Include = "Id,NazivPodpredmeta,Sifra,PredmetId")] Podpredmet podpredmet)
        {
            if (ModelState.IsValid)
            {
                _db.Edit(podpredmet);

                TempData["Success"] = "Uspešno izmenjen podpredmet!";
                return(RedirectToAction("Index"));
            }

            return(View(podpredmet));
        }
Esempio n. 3
0
        public ActionResult Create([Bind(Include = "Id,NazivPodpredmeta,Sifra,PredmetId")] Podpredmet podpredmet)
        {
            if (ModelState.IsValid)
            {
                _db.Add(podpredmet);

                TempData["Success"] = "Uspešno ste dodali podpredmet";
                return(RedirectToAction("Index"));
            }

            return(View(podpredmet));
        }
Esempio n. 4
0
        // GET: Podpredmets/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Podpredmet podpredmet = _db.FindById(Convert.ToInt32(id));

            if (podpredmet == null)
            {
                return(HttpNotFound());
            }
            return(View(podpredmet));
        }
Esempio n. 5
0
        // GET: Podpredmets/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Podpredmet podpredmet = _db.FindById(Convert.ToInt32(id));

            if (podpredmet == null)
            {
                return(HttpNotFound());
            }

            ViewBag.PredmetId = new SelectList(_pDb.GetPredmeti(), "Id", "NazivPredmeta");

            return(View(podpredmet));
        }
 public void Edit(Podpredmet p)
 {
     _context.Entry(p).State = System.Data.Entity.EntityState.Modified;
     _context.SaveChanges();
 }
 public void Add(Podpredmet p)
 {
     _context.Podpredmeti.Add(p);
     _context.SaveChanges();
 }