Ejemplo n.º 1
0
        // 1. *************RETRIEVE ALL EMPLOYEE DETAILS ******************
        // GET: Employee
        public ActionResult Index()
        {
            EmployeeDBHandle dbhandle = new EmployeeDBHandle();

            ModelState.Clear();
            return(View(dbhandle.GetEmployee()));
        }
        // GET: E/Edit/5
        public ActionResult Edit(int id)
        {
            EmployeeDBHandle edb = new EmployeeDBHandle();
            var result           = edb.GetEmployee().Find(emodel => emodel.Id == id);

            return(View(result));
        }
 public ActionResult Edit(int id, EModel emodel)
 {
     try
     {
         EmployeeDBHandle edb = new EmployeeDBHandle();
         edb.UpdateDetails(emodel);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Action(int id, EModel emodel)
 {
     try
     {
         EmployeeDBHandle edb = new EmployeeDBHandle();
         edb.Search(emodel);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
        // GET: E/Delete/5
        public ActionResult Delete(int id)
        {
            try
            {
                // TODO: Add delete logic here
                EmployeeDBHandle edb = new EmployeeDBHandle();
                if (edb.DeleteEmployees(id))
                {
                    ViewBag.AlertMsg = "Employee Record Deleted Successfully";
                }
                return(RedirectToAction("Index"));
            }


            catch
            {
                return(View());
            }
        }
Ejemplo n.º 6
0
 public ActionResult Create(EmployeeModel emodel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             EmployeeDBHandle sdb = new EmployeeDBHandle();
             if (sdb.AddEmployee(emodel))
             {
                 ViewBag.Message = "Employee Details Added Successfully.";
                 ModelState.Clear();
             }
         }
         return(View());
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public ActionResult Create(EModel emodel)
        {
            try
            {
                // TODO: Add insert logic here
                if (ModelState.IsValid)
                {
                    EmployeeDBHandle edb = new EmployeeDBHandle();
                    if (edb.AddEmployee(emodel))
                    {
                        ViewBag.Message = "Employee Details Added Successfully";
                        ModelState.Clear();
                    }
                }

                return(View());
            }
            catch
            {
                return(View());
            }
        }