Example #1
0
 public static List<ArticleDto> GetFakeArticles()
 {
     var articles = new List<ArticleDto>();
     for (int i = 0; i < 32; i++)
     {
         var article = new ArticleDto
             {
                 Description = "Test description " + i,
                 Created = DateTime.Today + TimeSpan.FromHours(i),
                 Id = Guid.NewGuid(),
                 Text = "Test text " + i,
                 Title = "Test title " + i,
                 Comments = new List<CommentDto>()
             };
         for (int j = 0; j < 32; j++)
         {
             article.Comments.Add(new CommentDto
                 {
                     ArticleId = article.Id,
                     Created = DateTime.Today + TimeSpan.FromHours(j),
                     Id = Guid.NewGuid(),
                     Text = "Comment text " + i + "-" + j
                 });
         }
         articles.Add(article);
     }
     return articles;
 }
Example #2
0
 public void NewArticle(ArticleDto article)
 {
     _webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
     try
     {
         _webClient.UploadData("/Article/New", "POST", _serializer.Serialize(article));
     }
     catch (WebException ex)
     {
         throw new DataServiceException(GetFaultDto(ex));
     }
 }
Example #3
0
 public ArticleViewModel(IDataService dataService)
 {
     _dataService = dataService;
     ArticleDto = new ArticleDto
         {
             Id = Guid.Empty,
             Created = DateTime.Today,
             Description = "",
             Text = "",
             Title = "Новая статья",
             Comments = new List<CommentDto>()
         };
 }
Example #4
0
 public ArticleViewModel(ArticleDto articleDto, IDataService dataService)
     : this(dataService)
 {
     ArticleDto = articleDto;
 }