public ViewResult Display() { var context = new STUDENTDATAEntities(); var model = context.Studentdatas.ToList(); return(View(model)); }
public ActionResult AddStudent(Studentdata stu) { var context = new STUDENTDATAEntities(); context.Studentdatas.Add(stu); context.SaveChanges(); return(RedirectToAction("Display")); }
public ActionResult Find(string id) { int stuID = int.Parse(id); var context = new STUDENTDATAEntities(); var model = context.Studentdatas.FirstOrDefault((e) => e.stuid == stuID); return(View(model)); }
public ActionResult DeleteEmployee(string id) { int stuId = int.Parse(id); var context = new STUDENTDATAEntities(); var model = context.Studentdatas.FirstOrDefault((e) => e.stuid == stuId); context.Studentdatas.Remove(model); context.SaveChanges(); return(RedirectToAction("Display")); }
public ActionResult Find(Studentdata stu) { var context = new STUDENTDATAEntities(); var model = context.Studentdatas.FirstOrDefault((e) => e.stuid == stu.stuid); model.stufname = stu.stufname; model.stumname = stu.stumname; model.stulname = stu.stulname; model.stuaddress = stu.stuaddress; model.stuphone = stu.stuphone; model.stucourse = stu.stucourse; model.stuyear = stu.stuyear; context.SaveChanges(); return(RedirectToAction("Display")); }