Ejemplo n.º 1
0
        public HttpResponseMessage AddEmployee(NewEmployeeDto employee)
        {
            var employeeInfo      = new EmployeeRepository();
            var createNewEmployee = employeeInfo.AddNewEmployee(employee);

            return(Request.CreateResponse(HttpStatusCode.Created, employeeInfo));
        }
Ejemplo n.º 2
0
        public ActionResult Add(Employee objEmployee, bool IsPermanent)
        {
            EmployeeRepository objEmployeeRepository = new EmployeeRepository();

            objEmployeeRepository.AddNewEmployee(objEmployee, IsPermanent);
            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 3
0
        private void UpsertEmployeeAction(object parameter)
        {
            var values = (object[])parameter;

            var(name, surname, age, department, isValid, message) = ValidatedValues(values);

            if (!isValid)
            {
                MessageBox.Show(message, "Data error", MessageBoxButton.OK);

                return;
            }

            SelectedEmployee.Name       = name;
            SelectedEmployee.Surname    = surname;
            SelectedEmployee.Age        = age;
            SelectedEmployee.Department = department;

            if (SelectedEmployee.Id > 0)
            {
                SelectedEmployee = EmployeeRepository.UpdateEmpoyee(SelectedEmployee);
            }
            else
            {
                SelectedEmployee = EmployeeRepository.AddNewEmployee(SelectedEmployee);
            }

            RefreshEmployeeCollection();
        }
Ejemplo n.º 4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmEmployee fEmployee = new frmEmployee();

            fEmployee.Employee = EmployeeRepository.GetNewEmployee();
            fEmployee.ShowDialog();
            if (!fEmployee.WasCancelled)
            {
                EmployeeRepository.AddNewEmployee(fEmployee.Employee.Email, fEmployee.Employee.Phone, fEmployee.Employee.Age);
                RefreshDataGrid();
            }
        }
        public void Test_AddNewEmployee()
        {
            EmployeeModel emp = new EmployeeModel
            {
                ID         = 8,
                First_Name = "Ankit",
                Last_Name  = "Pratap",
                Age        = 45,
                Department = "Ministry of IT",
            };

            //Arrange
            IEmployeeRepository repository = new EmployeeRepository();

            //Act
            var result = repository.AddNewEmployee(emp);

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(8, result);
        }