Exemplo n.º 1
0
        public async Task <ActionResult <List <EmployeeSalary> > > Get()
        {
            try
            {
                List <EmployeeSalary> response = await BO.GetSalary();

                return(StatusCode(200, response));
            }
            catch (Exception)
            {
                return(StatusCode(500, _configuration.GetSection("Mensajes").GetSection("Error").Value));
            }
        }
Exemplo n.º 2
0
 public async Task <JsonResult> JsonListar(int Id)
 {
     if (Id > 0)
     {
         return(Json(await BO.GetSalary(Id)));
     }
     else if (Id == 0)
     {
         return(Json(await BO.GetSalary()));
     }
     else
     {
         return(Json(""));
     }
 }
Exemplo n.º 3
0
        public async Task <EmployeeResponseModel> GetEmployeeAsync(int id)
        {
            EmployeeResponseModel  employeeModel = new EmployeeResponseModel();
            IEnumerable <Employee> employees     = await employeeService.GetEmployees();

            Employee employee = employees.SingleOrDefault(s => s.Id == id);

            if (employee != null)
            {
                ISalary salary = salaryFactory.SelectEmployeeType(employee.ContractTypeName);
                employeeModel = new EmployeeResponseModel
                {
                    Id               = employee.Id,
                    RoleId           = employee.RoleId,
                    RoleName         = employee.RoleName,
                    Name             = employee.Name,
                    RoleDescription  = employee.RoleDescription,
                    ContractTypeName = employee.ContractTypeName,
                    Salary           = salary.GetSalary(employee),
                    AnualSalary      = salary.GetAnualSalary(employee)
                };
            }


            return(employeeModel);
        }
Exemplo n.º 4
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            ISalary o = obj switch
            {
                Teacher teacher => teacher,
                Student student => student,
                    _ => null
            };

            return(GetSalary().CompareTo(o.GetSalary()));
        }
    }
Exemplo n.º 5
0
        public void Get_annual_salary_correct()
        {
            Task <EmployeeSalary> employee = BO.GetSalary(1);

            Assert.AreEqual(employee.Result.Salary, 8640000);
        }
Exemplo n.º 6
0
        public ViewResult Detail(int?id)
        {
            var sal = _salaryrepository.GetSalary(id ?? 1);

            return(View(sal));
        }
Exemplo n.º 7
0
 private void buttonCalculateSalary_Click(object sender, EventArgs e)
 {
     modifyPerson = modifyPersonControl.Person;
     modifyPerson.GetSalary();
     modifyPersonControl.Person = modifyPerson;
 }