Beispiel #1
0
        // GET: Employee
        public ActionResult GetAllEmpDetails()
        {
            Emprepository Emprepo = new Emprepository();

            ModelState.Clear();

            return(View(Emprepo.GetAllEmployee()));
        }
Beispiel #2
0
 public ActionResult EditEmployeeDetails(EmpModel emp)
 {
     try
     {
         Emprepository Emprepo = new Emprepository();
         Emprepo.UpdateEmployee(emp);
         return(RedirectToAction("GetAllEmpDetails"));
     }
     catch (Exception)
     {
         return(View());
     }
 }
Beispiel #3
0
 public ActionResult DeleteEmployee(int id)
 {
     try
     {
         Emprepository Emprepo = new Emprepository();
         if (Emprepo.DeleteEmployee(id))
         {
             ViewBag.message = "Empleado correctamente";
         }
         return(RedirectToAction("GetAllEmpDetails"));
     }
     catch (Exception)
     {
         return(View());
     }
 }
Beispiel #4
0
 public ActionResult AddEmployee(EmpModel emp)
 {
     try
     {
         Emprepository Emprepo = new Emprepository();
         if (Emprepo.AddEmployee(emp))
         {
             ViewBag.message = "Almacenado correctamente";
         }
         return(RedirectToAction("GetAllEmpDetails"));
     }
     catch (Exception)
     {
         return(View());
     }
 }
Beispiel #5
0
        public ActionResult EditEmployeeDetails(int id)
        {
            Emprepository Emprepo = new Emprepository();

            return(View(Emprepo.GetAllEmployee().Find(Emp => Emp.Empid == id)));
        }