Browse Source

added cache

tags/v2.0
Robin Thoni 7 years ago
parent
commit
b366a30060
1 changed files with 23 additions and 8 deletions
  1. 23
    8
      backend/WebSem/WebApiWebSem/Business/ArticlesBusiness.cs

+ 23
- 8
backend/WebSem/WebApiWebSem/Business/ArticlesBusiness.cs View File

@@ -1,10 +1,12 @@
1
-using Luticate2.Utils.Business;
1
+using System.Linq;
2
+using Luticate2.Utils.Business;
2 3
 using Luticate2.Utils.Dbo.Basic;
3 4
 using Luticate2.Utils.Dbo.PaginatedRequest;
4 5
 using Luticate2.Utils.Dbo.Result;
5 6
 using Luticate2.Utils.Interfaces;
6 7
 using WebApiWebSem.DataAccess;
7 8
 using WebApiWebSem.Dbo.Articles;
9
+using WebApiWebSem.Dbo.ArticlesFields;
8 10
 
9 11
 namespace WebApiWebSem.Business
10 12
 {
@@ -20,13 +22,26 @@ namespace WebApiWebSem.Business
20 22
 
21 23
         public override LuResult<LuPaginatedDbo<ArticlesDbo>> GetMultiple(LuPaginatedRequestDbo request)
22 24
         {
23
-            return _dbPediaDataAccess.GetMultiple(request);
24
-//            var result = _dbPediaDataAccess.GetMultiple(request);
25
-//            if (result.Status == LuStatus.BackendError)
26
-//            {
27
-//                return base.GetMultiple(request);
28
-//            }
29
-//            return result;
25
+            var result = _dbPediaDataAccess.GetMultiple(request);
26
+            if (result.Status == LuStatus.BackendError)
27
+            {
28
+                return base.GetMultiple(request);
29
+            }
30
+            DataAccess.AddDbo(result.Data.Data.Select(dbo => new ArticlesAddDbo
31
+            {
32
+                Fields = dbo.Fields.Select(fieldsDbo => new ArticlesFieldsAddDbo
33
+                {
34
+                    Property = fieldsDbo.Property,
35
+                    Type = fieldsDbo.Type,
36
+                    Value = fieldsDbo.Value
37
+                }).ToList(),
38
+                Id = dbo.Id,
39
+                PictureCaption = dbo.PictureCaption,
40
+                PictureUrl = dbo.PictureUrl,
41
+                Text = dbo.Text,
42
+                Type = dbo.Type
43
+            }));
44
+            return result;
30 45
         }
31 46
     }
32 47
 }

Loading…
Cancel
Save