Exemplo n.º 1
0
        public ActionResult SaveEmployee(Employee e, string BtnSubmit)
        {
            switch(BtnSubmit)
            {
                case "Save Employee":
                    if (ModelState.IsValid)
                    {
                        EmployeeBusinessLayer ebl = new EmployeeBusinessLayer();
                        ebl.SaveEmployee(e);
                        return RedirectToAction("Index");
                    }
                    else
                    {
                        return View("AddEmployee");
                    }
                case "Cancel":
                    return RedirectToAction("Index");
            }

            return new EmptyResult();
        }
 public void SaveEmployee(Employee e)
 {
     SalesERPDAL s = new SalesERPDAL();
     s.Employees.Add(e);
     s.SaveChanges();
 }