public async Task <ApiResponse> AddNewEmployee([FromBody] AddNewEmployeeCommand model) { var userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; model.CreatedById = userId; model.CreatedDate = DateTime.UtcNow; return(await _mediator.Send(model)); }
private Form GetMainForm() { IEmployeeRepository employeeRepository = new InMemoryEmployeeRepository(); MainForm mainForm = new MainForm(); IEmployeeDetailPresenter employeeDetailPresenter = new EmployeeDetailPresenter(mainForm.ViewEmployeeDetail); ICommand<AddNewEmployeeData> addNewEmployeeCommand = new AddNewEmployeeCommand(employeeRepository); OrgChartPresenter presenter = new OrgChartPresenter(mainForm, employeeRepository, employeeDetailPresenter, addNewEmployeeCommand); presenter.Run(); return mainForm; }
private Form GetMainForm() { IEmployeeRepository employeeRepository = new InMemoryEmployeeRepository(); MainForm mainForm = new MainForm(); IEmployeeDetailPresenter employeeDetailPresenter = new EmployeeDetailPresenter(mainForm.ViewEmployeeDetail); ICommand <AddNewEmployeeData> addNewEmployeeCommand = new AddNewEmployeeCommand(employeeRepository); OrgChartPresenter presenter = new OrgChartPresenter(mainForm, employeeRepository, employeeDetailPresenter, addNewEmployeeCommand); presenter.Run(); return(mainForm); }
/// <summary> /// Handles the AddNewEmployee command /// </summary> /// <param name="command">The command</param> /// <returns></returns> public async Task HandleAsync(AddNewEmployeeCommand command) { var employeeDto = EmployeeDto.CreateNewEmployee(command.FirstName, command.LastName, command.BirthDate, command.Email, command.Password); await _employeeDal.AddNewEmployeeAsync(employeeDto); }
public async Task <ActionResult> Post([FromBody] AddNewEmployeeCommand command) { await _employeeHandler.HandleAsync(command).ConfigureAwait(false); return(StatusCode(201)); }
public void AddNewEmployeeRequested() { AddNewEmployeeCommand.Execute(new AddNewEmployeeData()); ShowEmployeeHierarchy(); }
public void AddNewEmployeeRequested() { AddNewEmployeeCommand.Execute(new AddNewEmployeeData()); }