public ActionResult Create([Bind(Include = "Account_Number,Account_Holdername,Email_id,Password,Confirm_Password,Mobile_Number,Address")] RegisterTable registerTable) { if (ModelState.IsValid) { db.RegisterTables.Add(registerTable); db.SaveChanges(); TempData["SuccessMessage"] = "Account created Successfully"; return(RedirectToAction("Index")); } return(View(registerTable)); }
public ActionResult Register(RegisterTable Rg) { using (PecuniaBankEntities DB = new PecuniaBankEntities()) //create an instance for table name to adding the data in the table { DB.RegisterTables.Add(Rg); //Add the data in table DB.SaveChanges(); //save the data } ModelState.Clear(); ViewBag.SuccessMessage = "Registration Successfully."; return(View("Register", new RegisterTable())); }