public ActionResult Create([Bind(Include = "ID,Name,Password")] User user) { IReposity db = new AcountReposity(); if (ModelState.IsValid) { if (db.SelectByName(user.Name) == null) { ACCOUNT account = new ACCOUNT(); account.USER_ID = user.ID.ToString(); account.USER_NAME = user.Name; account.PASSWORD = user.Password; db.Add(account); return RedirectToAction("Index"); } } return View(user); }
public void Add(ACCOUNT user) { db.ACCOUNT.Add(user); db.SaveChanges(); }