コード例 #1
0
        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));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            UpisNaPredmet upisNaPredmet = db.UpisNaPredmet.Find(id);

            db.UpisNaPredmet.Remove(upisNaPredmet);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "UpisNaPredmetId,PredmetId,StudentId,Ocjena")] UpisNaPredmet upisNaPredmet)
 {
     if (ModelState.IsValid)
     {
         db.Entry(upisNaPredmet).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PredmetId = new SelectList(db.Predmet, "PredmetId", "Naziv", upisNaPredmet.PredmetId);
     ViewBag.StudentId = new SelectList(db.Student, "ID", "Ime", upisNaPredmet.StudentId);
     return(View(upisNaPredmet));
 }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("UpisNaPredmetId,PredmetId,StudentId,Ocjena")] UpisNaPredmet upisNaPredmet)
        {
            if (ModelState.IsValid)
            {
                _context.Add(upisNaPredmet);
                await _context.SaveChangesAsync();

                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));
        }
コード例 #5
0
        // GET: UpisNaPredmets/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UpisNaPredmet upisNaPredmet = db.UpisNaPredmet.Find(id);

            if (upisNaPredmet == null)
            {
                return(HttpNotFound());
            }
            return(View(upisNaPredmet));
        }
コード例 #6
0
        // GET: UpisNaPredmets/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UpisNaPredmet upisNaPredmet = db.UpisNaPredmet.Find(id);

            if (upisNaPredmet == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PredmetId = new SelectList(db.Predmet, "PredmetId", "Naziv", upisNaPredmet.PredmetId);
            ViewBag.StudentId = new SelectList(db.Student, "ID", "Ime", upisNaPredmet.StudentId);
            return(View(upisNaPredmet));
        }