Skip to content

Commit

Permalink
Add auto mapper for product tags.
Browse files Browse the repository at this point in the history
Add product tag app services.
  • Loading branch information
RayMMond committed Jul 3, 2020
1 parent a1e447d commit 743ce2d
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using EasyAbp.EShop.Products.ProductTags.Dtos;
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Products.Authorization;
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;

namespace EasyAbp.EShop.Products.ProductTags
{
class ProductTagAppService : CrudAppService<ProductTag, ProductTagDto, Guid, GetProductTagListDto, object, object>,
IProductTagAppService
{
public ProductTagAppService(IRepository<ProductTag, Guid> repository) : base(repository)
{
}

protected override string GetListPolicyName { get; set; } = ProductsPermissions.Products.Default;

protected override IQueryable<ProductTag> CreateFilteredQuery(GetProductTagListDto input)
{
var queryable = Repository.AsQueryable();

if (input.TagId.HasValue)
{
queryable = queryable.Where(x => x.TagId == input.TagId);
}

if (input.ProductId.HasValue)
{
queryable = queryable.Where(x => x.ProductId == input.ProductId);
}

return queryable;
}

[RemoteService(false)]
public override Task<ProductTagDto> GetAsync(Guid id)
{
throw new NotSupportedException();
}

[RemoteService(false)]
public override Task<ProductTagDto> CreateAsync(object input)
{
throw new NotSupportedException();
}

[RemoteService(false)]
public override Task<ProductTagDto> UpdateAsync(Guid id, object input)
{
throw new NotSupportedException();
}

[RemoteService(false)]
public override Task DeleteAsync(Guid id)
{
throw new NotSupportedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
using EasyAbp.EShop.Products.ProductDetailHistories.Dtos;
using EasyAbp.EShop.Products.ProductHistories;
using EasyAbp.EShop.Products.ProductHistories.Dtos;
using EasyAbp.EShop.Products.ProductTags;
using EasyAbp.EShop.Products.ProductTags.Dtos;
using EasyAbp.EShop.Products.Tags;
using EasyAbp.EShop.Products.Tags.Dtos;
using Volo.Abp.AutoMapper;
using Volo.Abp.DependencyInjection;

Expand Down Expand Up @@ -63,6 +67,10 @@ public ProductsApplicationAutoMapperProfile(IAttributeOptionIdsSerializer attrib
CreateMap<ProductCategory, ProductCategoryDto>();
CreateMap<ProductHistory, ProductHistoryDto>();
CreateMap<ProductDetailHistory, ProductDetailHistoryDto>();
CreateMap<CreateTagDto, TagDto>(MemberList.Source);
CreateMap<UpdateTagDto, TagDto>(MemberList.Source);
CreateMap<Tag, TagDto>();
CreateMap<ProductTag, ProductTagDto>();
}
}
}

0 comments on commit 743ce2d

Please sign in to comment.