public ActionResult Edit(Class cls) { if (ModelState.IsValid) { ClassBO.Update(cls); return(RedirectToAction("Index")); } int MajorID = cls.MajorID; ViewBag.MajorID = slFactory.MakeSelectList <Major>("MajorID", "FullName", MajorID); return(View(cls)); }
//更新博客id static void Update() { ClassBusiness cb = new ClassBusiness(); Console.WriteLine("请输入id"); int id = int.Parse(Console.ReadLine()); ClassName blog = cb.Query(id); Console.Write("请输入新博客名:"); string name = Console.ReadLine(); blog.Name = name; cb.Update(blog); }