123456789101112131415161718192021222324252627282930 |
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using GxPress.Repository.Interface.Group;
- using GxPress.Result.Web;
- using GxPress.Service.Interface.GroupCategory;
- namespace GxPress.Service.Implement.GroupCategory
- {
- public class GroupCategoryService : IGroupCategoryService
- {
- private readonly IGroupCategoryRepository GroupCategoryRepository;
- private readonly IUserGroupCategoryRepository userGroupCategoryRepository;
- public GroupCategoryService(IGroupCategoryRepository GroupCategoryRepository, IUserGroupCategoryRepository userGroupCategoryRepository)
- {
- this.GroupCategoryRepository = GroupCategoryRepository;
- this.userGroupCategoryRepository = userGroupCategoryRepository;
- }
- public async Task<IEnumerable<GroupCategoryResult>> GetGroupCategoryAsync(int parentId, int userId)
- {
- if (userId > 0)
- {
- if (await userGroupCategoryRepository.IsExistsAsync(userId))
- {
- return await GroupCategoryRepository.GetUsergroupCategoryResult(userId);
- }
- }
- return await GroupCategoryRepository.GetAllAsync(parentId);
- }
- }
- }
|