예제 #1
0
        public async Task <object> Add(Employee employee)
        {
            bool isValid = await _employeeService.AddEmployee(employee);

            _notification.SetNotificationMessage(isValid, Title, employee.UID);

            return(_notification);
        }
예제 #2
0
        public IActionResult AddEmployee()
        {
            int newId = _employeesService.GetEmployees().Count() + 1;

            Employee emp = new Employee {
                Name = "John", Surename = "Doe", Patronymic = "J",
                Age  = 36, Gender = "Мужской", Id = newId, Profession = "Control system engeneer"
            };

            _employeesService.AddEmployee(emp);

            return(View(_employeesService.GetEmployees()));
        }
예제 #3
0
 public IActionResult Post(Employee employee)
 {
     var(isSuccess, errorMessage) = _employeeService.AddEmployee(employee);
     return(isSuccess ? (IActionResult)Ok(new { success = true }) : Ok(new { errorMessage }));
 }