public IActionResult AddNewDepartment(DeptDto newDept) { if (newDept != null && newDept.Id == 0) { var added = _deptLogic.UpdateDept(newDept, OperationTypeEnum.Add); return(Ok(DtoTransfer.ConvertDeptToDto(added))); } return(BadRequest()); }
public IActionResult UpdateDepartment(DeptDto updated) { if (updated != null && updated.Id != 0) { var result = _deptLogic.UpdateDept(updated); return(Ok(DtoTransfer.ConvertDeptToDto(result))); } return(BadRequest()); }
public IActionResult DeactivateDepartment(int deptId) { if (deptId != 0) { var dept = _deptLogic.DeactivateDept(deptId); if (dept != null) { return(Ok(DtoTransfer.ConvertDeptToDto(dept))); } return(NotFound()); } return(BadRequest()); }
public async Task <IActionResult> AddEmployeesAsync(int deptId, ICollection <string> empIds) { if (deptId != 0 && empIds != null && empIds.Count > 0) { var dept = await _deptLogic.AddEmployeesAsync(deptId, empIds); if (dept != null) { return(Ok(DtoTransfer.ConvertDeptToDto(dept))); } return(NotFound()); } return(BadRequest()); }