0





22

Advertisement

namespace Employee.Controllers
{
    public class EmployeController : Controller
    {
        EmployeeEntities db = new EmployeeEntities();
        // GET: Employe
        public ActionResult Index()
        {
            return View(db.Tables.ToList());
        }
        // GET: Add Employee
        [HttpGet]
        public ActionResult Create()
        {
            return View();
        }
        [HttpPost]
        // POST
        public ActionResult Create(EmployeController employe)
        {
            if(ModelState.IsValid)
            {
                db.Tables.Add(employe);

            }
            return View(employe);
        }
Question author Manoj-sharma | Source

Advertisement


0


I think your problem is obvious. You mistakenly pass EmployeController employe in your action Create (post). Change it with your actual model.

Answer author Jtabuloc