private void HandleDeleteArticle(NetworkStream stream)
        {
            try
            {
                Console.WriteLine("Client deleting article");
                Utils.SendObject(Constants.Success, stream);
                var articleUpdateDto = Utils.ReadObject <ArticleUpdateDto>(stream);
                var writer           =
                    _writerBll.FindWriter(articleUpdateDto.WriterDto.Name, articleUpdateDto.WriterDto.Password);
                if (writer == null)
                {
                    throw new ArgumentException();
                }
                var article = MapToArticle(articleUpdateDto);
                _articleBll.DeleteArticle(article);
                Utils.SendObject(Constants.Success, stream);

                Console.WriteLine("Successfully updated article");

                NotifyObservers();
            }
            catch (Exception e)
            {
                Utils.SendObject(Constants.Error, stream);
            }
        }
示例#2
0
 public bool Delete(int id)
 {
     return(artBll.DeleteArticle(id));
 }