public ActionResult <IEnumerable <ProductDetailDto> > GetAll()
        {
            var productdetails = _productdetailService.GetAll();

            if (productdetails == null)
            {
                List <string> errorMessage = new List <string>();
                errorMessage.Add("Đã phát sinh lỗi, vui lòng thử lại");
                return(BadRequest(new ResponseDto(errorMessage, 500, productdetails)));
            }


            List <string> successMessage = new List <string>();

            successMessage.Add("Lấy danh mục con hàng hoá thành công");
            var responseDto = new ResponseDto(successMessage, 200, productdetails);

            return(Ok(responseDto));
        }
Beispiel #2
0
        public HttpResponseMessage Get(HttpRequestMessage request)
        {
            return(CreateHttpResponse(request, () =>
            {
                var listProductDetail = _productDetailService.GetAll();

                HttpResponseMessage response = request.CreateResponse(HttpStatusCode.OK, listProductDetail);


                return response;
            }));
        }