public ActionResult Create([Bind(Include = "Id,Title")] Designation designation) { if (ModelState.IsValid) { db.Designations.Add(designation); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(designation)); }
public ActionResult Create([Bind(Include = "Id,Name,DesignationId,JoiningDate")] Employee employee) { if (ModelState.IsValid) { db.Employees.Add(employee); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.DesignationId = new SelectList(db.Designations, "Id", "Title", employee.DesignationId); return(View(employee)); }