Exemplo n.º 1
0
 // GET: Employee/Create
 public ActionResult Create()
 {
     try
     {
         EmployeeService.EmployeeServiceClient client = new EmployeeService.EmployeeServiceClient();
         client.AddEmployee();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Add(Employee employee)
 {
     if (ModelState.IsValid)
     {
         EmployeeService.EmployeeDTO employeeDTO = new EmployeeService.EmployeeDTO()
         {
             EmployeeID        = employee.EmployeeID,
             EmployeeFirstName = employee.EmployeeFirstName,
             EmployeeLastName  = employee.EmployeeLastName,
             DepartmentID      = employee.DepartmentID
         };
         if (client.AddEmployee(employeeDTO) > 0)
         {
             ViewBag.Result = "Employee Added Successfully";
             return(View(employee));
         }
     }
     return(View(employee));
 }