Exemplo n.º 1
0
 public IActionResult EmployeeCreate(Employee employee)
 {
     if (ModelState.IsValid)
     {
         objEmployee.AddEmployee(employee);
         return(RedirectToAction("AllEmployee", "OpsManager"));
     }
     return(View(employee));
 }
 public void AddEmployee(Employee employee)
 {
     try
     {
         _employeeDataLayer.AddEmployee(employee);
     }
     catch (FormatException ex)
     {
         throw;
     }
     catch (Exception ex) when(ex.Message == "Unable to add employee because of database connection")
     {
         //throw new Exception("Employee Not Added, try again!", ex);
         throw;
     }
     catch (Exception ex)
     {
         throw;
     }
 }