public ActionResult GetInsertableGradeRegistrations(int selectedExamSubject) { var ctx = new AppDbContext(); var model = new InsertGradesModel(ctx, selectedExamSubject); return(PartialView(model)); }
public ActionResult InsertGrades() { ViewBag.ExamSubjects = new AppDbContext().Exams .Where(e => e.DateTime.HasValue && e.DateTime.Value < DateTime.Now) .Select(e => new SelectListItem() { Value = e.Id.ToString(), Text = e.Subject.Name }); var model = new InsertGradesModel(); return(View(model)); }
public ActionResult InsertGrades(InsertGradesModel model) { throw new NotImplementedException(); //var ctx = new AppDbContext(); //var subject = ctx.Subjects.SingleOrDefault(s => s.Id == model.ExamSubject); //if (subject == null) //{ // throw new Exception("Subject does not exist."); //} //var insertGrades = new ExamRegistration(model.AppUserFirstName, model.AppUserLastName,model.ExamRegistrationGrade,model.ExamSubjectName, model.StudentNumber ); //ctx.ExamRegistrations.Add(insertGrades); //ctx.SaveChanges(); //return RedirectToAction("InsertExam"); }