1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- using System.Linq;
- using Luticate2.Utils.Business;
- using Luticate2.Utils.Dbo.Basic;
- using Luticate2.Utils.Dbo.PaginatedRequest;
- using Luticate2.Utils.Dbo.Result;
- using Luticate2.Utils.Interfaces;
- using WebApiWebSem.DataAccess;
- using WebApiWebSem.Dbo.Articles;
- using WebApiWebSem.Dbo.ArticlesFields;
-
- namespace WebApiWebSem.Business
- {
- public class ArticlesBusiness : LuCrudBusiness<ArticlesDataAccess, ArticlesAddDbo, ArticlesDbo, ArticlesEditDbo, string>
- {
- private readonly DbPediaDataAccess _dbPediaDataAccess;
-
- public ArticlesBusiness(ArticlesDataAccess dataAccess, ILuNotificationsBusiness notificationsBusiness, DbPediaDataAccess dbPediaDataAccess) : base(dataAccess, notificationsBusiness)
- {
- _dbPediaDataAccess = dbPediaDataAccess;
- EntityType = "articles";
- }
-
- public override LuResult<LuPaginatedDbo<ArticlesDbo>> GetMultiple(LuPaginatedRequestDbo request)
- {
- var result = _dbPediaDataAccess.GetMultiple(request);
- if (result.Status == LuStatus.BackendError)
- {
- return base.GetMultiple(request);
- }
- DataAccess.AddDbo(result.Data.Data.Select(dbo => new ArticlesAddDbo
- {
- Fields = dbo.Fields.Select(fieldsDbo => new ArticlesFieldsAddDbo
- {
- Property = fieldsDbo.Property,
- Type = fieldsDbo.Type,
- Value = fieldsDbo.Value
- }).ToList(),
- Id = dbo.Id,
- PictureCaption = dbo.PictureCaption,
- PictureUrl = dbo.PictureUrl,
- Text = dbo.Text,
- Type = dbo.Type
- }));
- return result;
- }
- }
- }
|