Prechádzať zdrojové kódy

集合判断IsEmpty移除

CrazyIter_Bin 4 rokov pred
rodič
commit
7286f34ff1

+ 4 - 4
TEAMModelOS.SDK/DI/AzureStorage/AzureStorageTableExtensions.cs

@@ -259,7 +259,7 @@ namespace TEAMModelOS.SDK.DI
 
         public static async Task<List<T>> DeleteAll<T>(this AzureStorageFactory azureStorage,  List<T> entitys) where T : TableEntity, new()
         {
-            if (entitys.IsEmpty())
+            if (!entitys.IsNotEmpty())
             {
                 return null;
             }
@@ -300,7 +300,7 @@ namespace TEAMModelOS.SDK.DI
 
         public static async Task<List<T>> SaveOrUpdateAll<T>(this AzureStorageFactory azureStorage, List<T> entitys) where T : TableEntity, new()
         {
-            if (entitys.IsEmpty())
+            if (!entitys.IsNotEmpty())
             {
                 return null;
             }
@@ -340,7 +340,7 @@ namespace TEAMModelOS.SDK.DI
         }
         public static async Task<List<T>> UpdateAll<T>(this AzureStorageFactory azureStorageFactory, List<T> entitys) where T : TableEntity, new()
         {
-            if (entitys.IsEmpty())
+            if (!entitys.IsNotEmpty())
             {
                 return null;
             }
@@ -380,7 +380,7 @@ namespace TEAMModelOS.SDK.DI
         }
         public static async Task<List<T>> SaveAll<T>(this AzureStorageFactory azureStorage, List<T> entitys) where T : TableEntity, new()
         {
-            if (entitys.IsEmpty())
+            if (!entitys.IsNotEmpty())
             {
                 return null;
             }

+ 1 - 16
TEAMModelOS.SDK/Helper/Common/CollectionHelper/CollectionHelper.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections;
 using System.Collections.Generic;
 
@@ -8,21 +8,6 @@ namespace TEAMModelOS.SDK.Helper.Common.CollectionHelper
 {
     public static class CollectionHelper
     {
-        /// <summary>
-        /// 判断集合是否为空
-        /// </summary>
-        /// <param name="collection"></param>
-        /// <returns></returns>
-        public static bool IsEmpty(this ICollection collection)
-        {
-            if (collection != null && collection.Count > 0)
-            {
-                return false;
-            }
-            else {
-                return true;
-            }
-        }
         /// <summary>
         /// 判断集合是否不为空
         /// </summary>

+ 2 - 0
TEAMModelOS/Controllers/Teacher/TeacherCommonController.cs

@@ -1,3 +1,4 @@
+using Azure.Cosmos;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
@@ -11,6 +12,7 @@ using TEAMModelOS.Filter;
 using TEAMModelOS.Models;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Extension;
+using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
 using TEAMModelOS.SDK.Models.Cosmos;
 using TEAMModelOS.Services.Common;