public ActionResult SubjectAdd(long id) { mst_subjectmarks subjectData = new mst_subjectmarks(); try { subjectData.student_id = id; } catch (Exception ex) { } return(View(subjectData)); }
public ActionResult SubjectEdit(long?id) { mst_subjectmarks subjectData = new mst_subjectmarks(); try { demoEntities db = new demoEntities(); subjectData = db.mst_subjectmarks.First(c => c.subject_id == id); } catch (Exception ex) { } return(View(subjectData)); }
public ActionResult SubjectDelete(long?id) { try { demoEntities db = new demoEntities(); mst_subjectmarks subject = db.mst_subjectmarks.First(c => c.subject_id == id); db.mst_subjectmarks.Remove(subject); db.SaveChanges(); return(RedirectToAction("studentlist")); } catch (Exception ex) { return(RedirectToAction("studentlist")); } }
public ActionResult SubjectAdd(mst_subjectmarks subjectData) { try { if (ModelState.IsValid) { demoEntities db = new demoEntities(); db.mst_subjectmarks.Add(subjectData); db.SaveChanges(); return(RedirectToAction("studentlist")); } else { return(View(subjectData)); } } catch (Exception ex) { return(View(subjectData)); } }
public ActionResult SubjectEdit(mst_subjectmarks subjectData) { try { if (ModelState.IsValid) { demoEntities db = new demoEntities(); mst_subjectmarks subject = db.mst_subjectmarks.First(c => c.subject_id == subjectData.subject_id); subject.subject_name = subjectData.subject_name; subject.marks = subjectData.marks; db.SaveChanges(); return(RedirectToAction("studentlist")); } else { return(View(subjectData)); } } catch (Exception ex) { return(View(subjectData)); } }