日期:2014-05-20 浏览次数:21258 次
public ActionResult Index() { ViewBag.Message = "Welcome to ASP.NET MVC!"; // ViewData.Model = _db.userSet.ToList(); Models.userEntities de = new Models.userEntities(); //创建新对象 Models.user user = new Models.user(); user.uname = "xxx"; user.uemmail = "sdfsdf"; de.AddTouserSet(user);//添加数据到集合 de.SaveChanges();//将数据添加到数据库 return View(); }