public ActionResult Create([Bind(Include = "EmpId,Name,Gender,Age,Position,Office,HireDate,Salary,DepartmentId")] Employee employee) { if (ModelState.IsValid) { db.Employee.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DepartmentId = new SelectList(db.Department, "DeptId", "DepartmentName", employee.DepartmentId); return(View(employee)); }
public ActionResult Signup(Users model) { using (var context = new RNTAEntities()) { context.Users.Add(model); context.SaveChanges(); } return(RedirectToAction("Login")); }