public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            BinhLuan modelBinhLuan = null;

            try
            {
                modelBinhLuan = _binhLuanService.Delete(id);
                _binhLuanService.SaveChange();
                if (modelBinhLuan != null)
                {
                    if (modelBinhLuan.IdBaiViet != null)
                    {
                        var baiViet = _baiVietService.GetById((int)modelBinhLuan.IdBaiViet);
                        baiViet.SoCmt--;
                        _baiVietService.SaveChange();
                    }
                    Message = "Xóa binh luan thành công";
                }
                else
                {
                    throw new DbEntityValidationException("Xóa binh luan không thành công");
                }
            }
            catch (DbEntityValidationException ex)
            {
                LogException(ex);
            }
            return(GetResponseMessage(IsSuccess, Message, 1, modelBinhLuan));
        }
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            BaiViet modelBaiViet = null;

            try
            {
                var listBinhLuan = _binhLuanService.BinhLuanWithIdBaiViet(id);
                foreach (var item in listBinhLuan)
                {
                    _binhLuanService.Delete(item.IdBinhLuan);
                }
                _baiVietService.SaveChange();
                modelBaiViet = _baiVietService.Delete(id);
                _baiVietService.SaveChange();
                if (modelBaiViet != null)
                {
                    Message = "Xóa Bài Viet thành công";
                }
                else
                {
                    throw new DbEntityValidationException("Xóa Bài Viet không thành công");
                }
            }
            catch (DbEntityValidationException ex)
            {
                LogException(ex);
            }
            return(GetResponseMessage(IsSuccess, Message, 1, modelBaiViet));
        }
        public HttpResponseMessage Delete(HttpRequestMessage request, int id)
        {
            ChuyenMuc modelChuyenMuc = null;

            try
            {
                var listBaiViet = _baiVietService.BaiVietWithIdChuyenMuc(id);
                foreach (var item in listBaiViet)
                {
                    var listBinhLuan = _binhLuanService.BinhLuanWithIdBaiViet(id);
                    foreach (var item2 in listBinhLuan)
                    {
                        _binhLuanService.Delete(item2.IdBinhLuan);
                    }
                    _chuyenMucService.SaveChange();
                    _baiVietService.Delete(item.IdBaiViet);
                }
                _chuyenMucService.SaveChange();
                modelChuyenMuc = _chuyenMucService.Delete(id);
                _chuyenMucService.SaveChange();
                if (modelChuyenMuc != null)
                {
                    Message = "Xóa chuyên mục thành công";
                }
                else
                {
                    throw new DbEntityValidationException("Xóa chuyên mục không thành công");
                }
            }
            catch (DbEntityValidationException ex)
            {
                LogException(ex);
            }
            return(GetResponseMessage(IsSuccess, Message, 1, modelChuyenMuc));
        }