Ejemplo n.º 1
0
        public JsonResult UpdateAnExistingEmployee(int employeeId, [FromBody] EmployeeToUpdate employeeToUpdate)
        {
            try
            {
                var modifiedEmployee = new Employee
                {
                    EmployeeAddress = employeeToUpdate.Address,
                    EmployeeAge     = employeeToUpdate.Age,
                    EmployeeName    = employeeToUpdate.Name,
                    EmployeeSalary  = employeeToUpdate.Salary,
                    EmployeeStatus  = employeeToUpdate.Status
                };

                return(new JsonResult(_employeeService.UpdateAnExistingEmployee(employeeId, modifiedEmployee)));
            }
            catch (Exception ex)
            {
                return(new JsonResult(ResponseValidation.GetHTTPStatusCode(ex)));
            }
        }
        public Task <Employee> UpdateEmployeeAsync(string authToken, string boxId, string userId, EmployeeToUpdate employeeToUpdate)
        {
            var queryString = new PathAndQueryBuilder("/UpdateEmployee");

            queryString.AddParameter("boxId", boxId);
            queryString.AddParameter("userId", userId);
            return(PerformHttpRequestAsync <EmployeeToUpdate, Employee>(authToken, queryString.BuildPathAndQuery(), employeeToUpdate));
        }