From 83b0a0b2711f789f4185bdfb416752add0ad7fed Mon Sep 17 00:00:00 2001 From: tanglong <842690096@qq.com> Date: Fri, 25 Jul 2025 10:09:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Impl/DeviceService.cs | 24 +++++-------------- 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/YD_AllHeartRates.Api/Services/Impl/DeviceService.cs b/YD_AllHeartRates.Api/Services/Impl/DeviceService.cs index 88ef837..220ef81 100644 --- a/YD_AllHeartRates.Api/Services/Impl/DeviceService.cs +++ b/YD_AllHeartRates.Api/Services/Impl/DeviceService.cs @@ -174,12 +174,8 @@ namespace YD_AllHeartRates.Api.Services.Impl await _sportsContext.AddAsync(entity); var res = await _sportsContext.SaveChangesAsync() > 0; - if (res) - { - _caching.Remove(AppSettings.DeviceListCacheKey); - return true; - } - return false; + _caching.Remove(AppSettings.DeviceListCacheKey); + return res; } /// @@ -210,12 +206,8 @@ namespace YD_AllHeartRates.Api.Services.Impl _sportsContext.Update(device); var res = await _sportsContext.SaveChangesAsync() > 0; - if (res) - { - _caching.Remove(AppSettings.DeviceListCacheKey); - return true; - } - return false; + _caching.Remove(AppSettings.DeviceListCacheKey); + return res; } /// @@ -233,12 +225,8 @@ namespace YD_AllHeartRates.Api.Services.Impl _sportsContext.Device.Remove(device); var res = await _sportsContext.SaveChangesAsync() > 0; - if (res) - { - _caching.Remove(AppSettings.DeviceListCacheKey); - return true; - } - return false; + _caching.Remove(AppSettings.DeviceListCacheKey); + return res; } ///