public async Task <ActionResult <Department> > GetDepartment(int id) { try { var result = await departmentRepo.GetDepartment(id); if (result == null) { return(NotFound()); } return(Ok(result)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Error retrieving data")); } }
public ActionResult <IEnumerable <Department> > GetDepartment() { var departmentItems = _repository.GetDepartment(); return(Ok(departmentItems)); }
public IHttpActionResult GetDepartment(int id) { var data = packingType.GetDepartment(id); return(Ok(data)); }