Esempio n. 1
0
        public ActionResult Post([FromBody] object requestBody)
        {
            EmployeeInformation employeeRecord = Utilities.Utility.ParseJSONArray <EmployeeInformation>(requestBody.ToString());

            var res = _employeAdapter.Post(employeeRecord);

            string result = JsonConvert.SerializeObject(res);

            return(Ok(result));
        }
Esempio n. 2
0
        public ActionResult GetEmployeeSalaryInfo([FromBody] object requestBody)
        {
            EmployeeInformation employeeRecord = Utilities.Utility.ParseJSONArray <EmployeeInformation>(requestBody.ToString());

            var res = _employeAdapter.Post(employeeRecord);

            if (!res.Contains("successfully inserted data"))
            {
                return(BadRequest(string.Format($"Failed to insert new employee")));
            }

            EmployeeSalaryInformation _salary = _benefitCostCalculator.CalculateEmployeeSalary(employeeRecord);

            string result = JsonConvert.SerializeObject(_salary);

            return(Ok(result));
        }