public async Task <object> Add(Employee employee) { bool isValid = await _employeeService.AddEmployee(employee); _notification.SetNotificationMessage(isValid, Title, employee.UID); return(_notification); }
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())); }
public IActionResult Post(Employee employee) { var(isSuccess, errorMessage) = _employeeService.AddEmployee(employee); return(isSuccess ? (IActionResult)Ok(new { success = true }) : Ok(new { errorMessage })); }