예제 #1
0
        public void AddEmployee()
        {
            EmployeeVm employee = EmployeeView.ShowAddEmployeeView();

            if (employee != null)
            {
                var domainEmployee = new Employee()
                {
                    Name = employee.Name, Country = employee.Country, HoursWorked = int.Parse(employee.HoursWorked), HourlyRate = double.Parse(employee.HourlyRate)
                };

                try
                {
                    _repository.Add(domainEmployee);
                    EmployeeView.ShowMessage("Funcionário adicionado com sucesso.");
                }
                catch (Exception e)
                {
                    EmployeeView.ShowMessage("Erro ao adicionar o funcionário.");
                }
            }
        }