コード例 #1
0
        public HttpResponseMessage GetAllForTrue(HttpRequestMessage request)
        {
            IEnumerable <SanPham> listSanPham = null;
            var toTal = 0;

            try
            {
                listSanPham = _sanPhamService.GetAllForTrue();
                toTal       = listSanPham.ToList().Count;
                if (toTal > 0)
                {
                    Message = "Danh sách sản phẩm";
                }
                else
                {
                    throw new DbEntityValidationException("Không tồn tại sản phẩm nào");
                }
            }
            catch (DbEntityValidationException ex)
            {
                LogException(ex);
            }
            return(GetResponseMessage(IsSuccess, Message, toTal, listSanPham));
        }