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"));
            }
        }
示例#2
0
        public ActionResult <IEnumerable <Department> > GetDepartment()
        {
            var departmentItems = _repository.GetDepartment();

            return(Ok(departmentItems));
        }
示例#3
0
        public IHttpActionResult GetDepartment(int id)
        {
            var data = packingType.GetDepartment(id);

            return(Ok(data));
        }