public ActionResult EditGrad(int id) { using (var db = new Entity.Entities()) { ViewBag.PreName = db.PreName.ToList(); } var dal = new DAL.RegisterSubDAL(); var teacher = dal.Searchgrad(id); return(View(teacher)); }
public ActionResult EditGrad(Entity.Register_Subjects model, int id) { try { var dal = new DAL.RegisterSubDAL(); var grad = dal.Searchgrad(id); grad.Grad = model.Grad; var result = dal.EditeGrad(grad); if (result) { Response.Write("<script> alert('แก้ไข้ข้อมูลสำเร็จ')</script>"); } return(RedirectToAction("Subject")); } catch (Exception) { Response.Write("<scrip> aler('ไม่สำเร็จ')</scrip>"); } return(View(model)); }