public async Task <IActionResult> GetDepartment(int?postId) { if (postId == null) { return(BadRequest()); } try { var post = await departmentsRepository.GetDepartment(postId); if (post == null) { return(NotFound()); } return(Ok(post)); } catch (Exception) { return(BadRequest()); } }
public async Task <Departments> GetDepartment(int id) { return(await _departmentsRepository.GetDepartment(id)); }