1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- using System.Collections.Generic;
- using System.Threading.Tasks;
- using GxPress.Entity.Topic;
- using GxPress.EnumConst;
- using GxPress.Repository.Interface.Topic;
- using GxPress.Service.Interface.Topic;
- using GxPress.Common.Tools;
- namespace GxPress.Service.Implement.Topic
- {
- public class TopicGroupService : ITopicGroupService
- {
- private readonly ITopicGroupRepository topicGroupRepository;
- public TopicGroupService(ITopicGroupRepository topicGroupRepository)
- {
- this.topicGroupRepository = topicGroupRepository;
- }
- /// <summary>
- /// 根据用户ID获取分组
- /// </summary>
- /// <param name="userId"></param>
- /// <returns></returns>
- public async Task<IEnumerable<TopicGroup>> GetTopicGroupsAsync(int userId)
- {
- var result = new List<TopicGroup>() {
- new TopicGroup {Id=TopicNotoGropConst.My.GetHashCode(),Name=TopicNotoGropConst.My.GetDescriptionOriginal()},
- new TopicGroup {Id=TopicNotoGropConst.Work.GetHashCode(),Name=TopicNotoGropConst.Work.GetDescriptionOriginal()},
- new TopicGroup {Id=TopicNotoGropConst.Recommend.GetHashCode(),Name=TopicNotoGropConst.Recommend.GetDescriptionOriginal() } ,
- new TopicGroup {Id=TopicNotoGropConst.All.GetHashCode(),Name=TopicNotoGropConst.All.GetDescriptionOriginal()}};
- result.AddRange(await topicGroupRepository.GetTopicGroupsAsync(userId));
- return result;
- }
- /// <summary>
- /// 根据用户ID获取分组
- /// </summary>
- /// <param name="userId"></param>
- /// <returns></returns>
- public async Task<IEnumerable<TopicGroup>> GetListTopicGroupsAsync(int userId)
- {
- var result = await topicGroupRepository.GetTopicGroupsAsync(userId);
- return result;
- }
- }
- }
|