public IActionResult SaveEdit(IspitDetaljiEditVM model) { IspitDetalji ispitDetalji = db.IspitDetalji.Where(x => x.Id == model.IspitDetaljiID) .Include(x => x.Student) .Include(x => x.Ispit) .FirstOrDefault(); ispitDetalji.Ocjena = model.Ocjena; db.IspitDetalji.Update(ispitDetalji); db.SaveChanges(); return(Redirect("/Ispit/Detalji?IspitID=" + ispitDetalji.IspitID)); }
public IActionResult Edit(int IspitDetaljiID) { IspitDetalji ispitDetalji = db.IspitDetalji.Where(x => x.Id == IspitDetaljiID) .Include(x => x.Student) .FirstOrDefault(); IspitDetaljiEditVM model = new IspitDetaljiEditVM() { IspitDetaljiID = IspitDetaljiID, Student = ispitDetalji.Student.Ime + " " + ispitDetalji.Student.Prezime }; return(PartialView(model)); }
public IActionResult IspitDetaljiSave(IspitDetaljiAddVM model) { IspitDetalji noviDetalji = new IspitDetalji { IspitID = model.IspitID, StudentID = model.StudentID, Ocjena = model.Ocjena, Pristupio = true }; db.IspitDetalji.Add(noviDetalji); db.SaveChanges(); return(Redirect("/Ispit/Detalji?IspitID=" + model.IspitID)); }
public IActionResult Pristupio(int IspitDetaljiID) { IspitDetalji ispitDetalji = db.IspitDetalji.Where(x => x.Id == IspitDetaljiID) .Include(x => x.Student) .FirstOrDefault(); if (ispitDetalji.Pristupio == true) { ispitDetalji.Pristupio = false; } else { ispitDetalji.Pristupio = true; } db.IspitDetalji.Update(ispitDetalji); db.SaveChanges(); return(Redirect("/Ispit/Detalji?IspitID=" + ispitDetalji.IspitID)); }