Exemple #1
0
 public List<Article> GetArticlesInGroup(ArticleGroup @group)
 {
     var listOfArtcile = @group.Groups.Select(name => _service.GetArticlesByParams(c => c.ArticleName == name, c => c.ArticleId, 0, 1).FirstOrDefault()).ToList();
     var res = _service.GetArticlesByParams(c => group.Groups.Contains(c.ArticleName),c=>c.ArticleId);
     group.Articles = listOfArtcile;
     return listOfArtcile;
 }
 public GroupViewItem(ArticleGroup group, IEnumerable<Article> articles)
 {
     _group = group;
     Articles = articles == null ? new List<Article>() : articles.ToList();
     IsExpanded = false;
     ArticlesCount = Articles.Count;
     Name = _group.GroupName;
 }
Exemple #3
0
        public ArticleGroup InitGroup(ArticleGroup group, IEnumerable<Article> articles)
        {
            bool flag = false;
            if (articles == null || !articles.Any())
            {
                articles = IocHelper.ArticleService.GetArticlesByParams(c => group.Groups.Contains(c.ArticleName), c => c.ArticleId);
                flag = true;
            }
            @group.Articles = flag ? articles.ToList() : articles.Where(c => @group.Groups.Contains(c.ArticleName)).ToList();

            return @group;
        }
Exemple #4
0
 public GroupDtoView(ArticleGroup articleGroup)
 {
     this.GroupId = articleGroup.GroupId;
     this.GroupName = articleGroup.GroupName;
     this.GroupsList = articleGroup.Groups;
 }
        public void ShoulImportData()
        {
            var groupRep = new GroupDbRepository();

            var group = new ArticleGroup
            {
                GroupName = "Федя"
            };

            var id = groupRep.Save(group);

            var str = "<XmlArticle><Article Link=\"http://ontime.spanishpoint.ie/\" AuthorName=\"Хабр\" ArticleName=\"Федя\" ArticleId=\"1\" GroupId=\"{0}\" InitialText=\"Федя\"></Article></XmlArticle>".Fmt(id);
            rep.Import(true, str.GetBytes());

            var actual = rep.GetByPredicate(c => c.ArticleName == "Федя", new QueryParams<Article>(0, 10, x => x.ArticleId)).FirstOrDefault();

            actual.Should(Be.Not.Null);
            actual.ArticleGroup.Should(Be.Not.Null);
        }
Exemple #6
0
 public void SaveGroup(ArticleGroup @group)
 {
     group.GroupId = _repository.Save(group);
 }
Exemple #7
0
 public void DeleteGroup(ArticleGroup @group)
 {
     _repository.Delete(group);
 }
Exemple #8
0
 public void UpdateGroup(ArticleGroup @group)
 {
     group.GroupId = _repository.Update(group);
 }
Exemple #9
0
 private ArticleGroup GetGroup()
 {
     if (GroupsComboBox.SelectedItem != null)
     {
         var name = GroupsComboBox.SelectedItem.ToString();
         return IocHelper.GroupService.GetGroupsByParams(c => c.GroupName == name, c => c.GroupId, 0, 1).FirstOrDefault();
     }
     else
     {
         var newGroup = new ArticleGroup
         {
             GroupName = GroupsComboBox.Text
         };
         IocHelper.GroupService.SaveGroup(newGroup);
         return newGroup;
     }
 }