public ActionResult Edit(long?Id) { if (Id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var entity = Dao.Detail(Id); if (entity == null) { return(HttpNotFound()); } ViewBag.TypeId = new SelectList(Dao.ListAllType(), "Id", "Name", entity.TypeId); ViewBag.ParentId = new SelectList(Dao.ListAll(), "Id", "Text", entity.ParentId); return(View(entity)); }