public ActionResult Create(SupportingMaterial sup) { if (ModelState.IsValid) { var dao = new SupportingMaterialsDAO(); int id = dao.Insert(sup); if (id > 0) { return(RedirectToAction("Index", "Organisantion")); } else { ModelState.AddModelError("", "Thêm sup không thành công!"); } } return(View("Index")); }
public int Insert(SupportingMaterial entity) { db.SupportingMaterials.Add(entity); db.SaveChanges(); return(entity.SupportingMaterialID); }