public IActionResult UpdateEmployee(int id, string availability, bool bar, bool _event, bool iets, int maxhours, string name, string phone) { var model = new EmployeeModel() { Id = id, Availability = availability, Bar = bar, Event = _event, Iets = iets, MaxHours = maxhours, Name = name, Phone = phone }; EmployeeLogic.UpdateEmployee(model); EmployeeModel viewmodeltransfer = EmployeeLogic.GetEmployee(id); var vm = new EmployeeViewModel() { Id = viewmodeltransfer.Id, Availability = viewmodeltransfer.Availability, Bar = viewmodeltransfer.Bar, Event = viewmodeltransfer.Event, Iets = viewmodeltransfer.Iets, MaxHours = viewmodeltransfer.MaxHours, Name = viewmodeltransfer.Name, Phonenumber = viewmodeltransfer.Phone }; return(View("ChangeEmployee", vm)); }
public EmployeeModule(IEmployeeLogic employeeLogic) : base("employees") { Post["/getEmployees"] = parameters => { var pagedRequest = this.Bind <EmployeePageRequest>(); var result = employeeLogic.LoadEmployees(pagedRequest); return(CreateResponse(result)); }; Get["/{id?}"] = parameters => { string id = parameters.id; int? empId = Convert.ToInt32(id); var result = employeeLogic.GetEmployee(empId); return(CreateResponse(result)); }; Post["/"] = parameters => { var employee = this.Bind <Employee>(); var result = employeeLogic.UpdateEmployee(employee); return(CreateResponse(result)); }; }
public Employee UpdateEmployee(long id, Employee employee) => _mapper.Map <Employee>(_employeeRepository.UpdateEmployee(id, _mapper.Map <PracticeAPI.BLL.Models.Employee>(employee)));
public IActionResult UpdateEmployee([FromBody] EmployeeDto employeeDto) { _employeeLogic.UpdateEmployee(employeeDto); return(NoContent()); }