Example #1
0
        public HttpResponseMessage GetAllByIdLoaiSanPham(HttpRequestMessage request, int id)
        {
            IEnumerable <SanPham> sanPhamAllByIdLoaiSanPham = null;
            var toTal = 0;

            try
            {
                sanPhamAllByIdLoaiSanPham = _sanPhamService.GetAllByIdLoaiSanPham(id);
                toTal = sanPhamAllByIdLoaiSanPham.ToList().Count;
                if (toTal > 0)
                {
                    Message = "Thông tin danh sach sản phẩm với id shop";
                }
                else
                {
                    throw new DbEntityValidationException(string.Format("Không tìm kiếm được thông tin sản phẩm với id shop {0}", id));
                }
            }
            catch (DbEntityValidationException ex)
            {
                LogException(ex);
            }
            return(GetResponseMessage(IsSuccess, Message, toTal, sanPhamAllByIdLoaiSanPham));
        }