public ViewResult SubmitForm([Bind] SchoolProject.Models.Form.Grades form) { IQueryable <Grades> grade = _context.grades.Where(s => s.student_id.Equals(form.student_id)); ViewBag.grades = grade; return(View()); }
public ViewResult InitForm([Bind] SchoolProject.Models.Form.Grades form) { // IQueryable<Grades> grade = from s in _context.grades // select s; var studid = HttpContext.Session.GetInt32("uid"); IQueryable <Grades> grade = _context.grades.Where(s => s.student_id == studid); ViewBag.grades = grade; return(View()); }
public ViewResult SubmitForm([Bind] SchoolProject.Models.Form.Grades form) { Grades gr = new Grades(); gr.grade_id = form.grade_id; gr.student_id = form.student_id; gr.subject_title = form.subject_title; gr.grade = form.grade; gr.remarks = form.remarks; gr.comment = form.comment; DateTime dateNow = DateTime.Now; gr.date_modified = dateNow; _context.grades.Add(gr); int rec = _context.SaveChanges(); if (rec == 1) { return(View()); } return(View("Error")); }