public IActionResult AddPermanentTeacher(PermanentTeacher r) { if (ModelState.IsValid) { PermanentTeacher t = new PermanentTeacher(); t.Id = r.Id; t.Name = r.Name; t.Type = r.Type; t.Designation = r.Designation; t.Contact = r.Contact; t.Address = r.Address; t.Email = r.Email; db.PermanentTeacher.Add(t); db.SaveChanges(); } return(Redirect("ViewPermanentTeacherList")); }
public IActionResult EditPermanentTeacher(PermanentTeacher f) { if (ModelState.IsValid) { PermanentTeacher t = new PermanentTeacher(); t.Id = f.Id; t.Name = f.Name; t.Type = f.Type; t.Designation = f.Designation; t.Contact = f.Contact; t.Address = f.Address; t.Email = f.Email; db.PermanentTeacher.Update(t); db.SaveChanges(); } return(RedirectToAction("ViewPermanentTeacherList")); }
public IActionResult ViewPermanentTeacherList() { var test = db.PermanentTeacher; var i = new List <PermanentTeacher>(); foreach (var f in test) { PermanentTeacher t = new PermanentTeacher(); t.Id = f.Id; t.Name = f.Name; t.Type = f.Type; t.Designation = f.Designation; t.Contact = f.Contact; t.Address = f.Address; t.Email = f.Email; i.Add(t); } return(View(i)); }