예제 #1
0
        public MorphemeDto GetMorpheme(string id)
        {
            using (var unitOfWork = DbContextFactory.CreateContext())
            {
                var morphemeRepository = unitOfWork.GetRepository <IMorphemeRepository>();
                var spec = MorphemeSpecifications.IdEquals(id);

                return(Mapper.Map <Morpheme, MorphemeDto>(
                           morphemeRepository.Get(spec, false)));
            }
        }
예제 #2
0
        public IEnumerable <MorphemeDto> GetMorphemeList(string fuzzyMorpheme, int maxCount, out int totalCount)
        {
            if (string.IsNullOrWhiteSpace(fuzzyMorpheme))
            {
                totalCount = 0;
                return(new MorphemeDto[0]);
            }

            using (var unitOfWork = DbContextFactory.CreateContext())
            {
                var morphemeRepository = unitOfWork.GetRepository <IMorphemeRepository>();
                var morphemeList       = morphemeRepository
                                         .GetAll(MorphemeSpecifications.StandardLike(fuzzyMorpheme.Trim()), false)
                                         .OrderBy(m => m.Standard)
                                         .Paging(1, maxCount, out totalCount);

                return(Mapper.Map <IEnumerable <Morpheme>, IEnumerable <MorphemeDto> >(morphemeList));
            }
        }