Пример #1
0
        private void Add_Button_Click(object sender, RoutedEventArgs e)
        {
            MainWindow main     = Application.Current.Windows.OfType <MainWindow>().First();
            article    _article = new article()
            {
                bibtexkey = bibtexKey_Txt.Text,
                title     = title_Txt.Text,
                year      = year_Txt.Text != "" ? Convert.ToInt32(year_Txt.Text) : null as int?,
                number    = number_Txt.Text != "" ? Convert.ToInt32(number_Txt.Text) : null as int?,
                month     = month_Txt.Text != "" ? Convert.ToInt32(month_Txt.Text) : null as int?,
                volume    = volume_Txt.Text != "" ? Convert.ToInt32(volume_Txt.Text) : null as int?,
                author    = author_Txt.Text,
                journal   = journal_Txt.Text,
                pages     = pages_Txt.Text,
                note      = note_Txt.Text,
                doi       = doi_Txt.Text,
                entrytype = GetEntryType.GetValueByEnum(GetEntryType.EntryType.Article)
            };


            bool result = AllFieldEmpty();

            if (!result)
            {
                _iArticleService.Add(_article);
                SetFieldClear();
                UIElement parent = App.Current.MainWindow;
                parent.IsEnabled = true;
                main.DataGridMain.ItemsSource = GetEntryType.GetAllByTypes();
                this.Close();
            }
            else
            {
                if (MessageBox.Show("Are you Sure to create a empty .bib", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                {
                    //do no stuff
                    return;
                }
                else
                {
                    _iArticleService.Add(_article);
                    SetFieldClear();
                    main.DataGridMain.ItemsSource = GetEntryType.GetAllByTypes();
                    UIElement parent = App.Current.MainWindow;
                    parent.IsEnabled = true;
                    this.Close();
                    //do yes stuff
                }
            }

            //var r=Application.Current.Windows.OfType<W_MessageBox>();
        }
Пример #2
0
        public void Add(ArticleDto data)
        {
            var article = new Article
            {
                Title   = data.Title,
                Content = data.Content
            };

            _articleDal.Add(article);
        }
Пример #3
0
        public IActionResult Post([FromBody] ArticleModel value)
        {
            if (value == null)
            {
                return(BadRequest());
            }
            value.CreatedDate = DateTime.Parse(DateTime.Now.ToString("MM/dd/yyyy hh:mm"));
            _articleDal.Add(_mapper.Map <Article>(value));

            return(Ok(_mapper.Map <ArticleModel>(value)));
        }
Пример #4
0
        public IResult Add(Article article)
        {
            var result = _articleDal.Find(p => p.Title == article.Title);

            if (result != null)
            {
                return(new ErrorResult("This Article already added"));
            }
            _articleDal.Add(article);
            return(new SuccessResult("Your Article successfully posted"));
        }
Пример #5
0
        public async Task <ActionResult <Article> > PostArticle(Article article)
        {
            System.Threading.Thread.Sleep(1000);
            article.CategoryId  = article.Category.Id;
            article.Category    = null;
            article.ViewCount   = 0;
            article.PublishDate = DateTime.Now;
            await _articleDal.Add(article);

            return(Ok());
        }
Пример #6
0
 public bool Add(Article article)
 {
     try
     {
         _articleDal.Add(article);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Пример #7
0
 public IActionResult Add([FromBody] ArticleInfo articleInfo)
 {
     try
     {
         _articleDal.Add(articleInfo);
         return(new StatusCodeResult(201));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Пример #8
0
        //[SecuredOperation("author,admin,moderator")]
        public IResult ArticleAdd(Article article)
        {
            article.Date = DateTime.Now;
            var result = BusinessRules.Run(IfTheseArticlesContain(article.Writing), CheckArticleTitleExists(article.Title), CheckDate(article.Date));

            if (result != null)
            {
                return(result);
            }

            _articleDal.Add(article);
            return(new SuccessResult(Messages.SuccessAdded));
        }
Пример #9
0
 public IResult Add(Article article)
 {
     _articleDal.Add(article);
     return(new SuccessResult(ArticleMessage.ArticleAdded));
 }
Пример #10
0
 public async Task AddArticle(Article article)
 {
     await _articleDal.Add(article);
 }
Пример #11
0
 public IResult Add(Article article)
 {
     //business code
     _articleDal.Add(article);
     return(new SuccessResult("Ürün başarıyla kaydedildi"));
 }
Пример #12
0
 public IResult Add(Article article)
 {
     _articleDal.Add(article);
     return(new SuccessResult(Messages.Success));
 }
Пример #13
0
 public string Add(Article article)
 {
     _IArticleDal.Add(article);
     return("Makale başarıyla eklendi");
 }
Пример #14
0
 public void Add(Articles entity)
 {
     _articleDal.Add(entity);
 }
Пример #15
0
 public void Add(Article product)
 {
     _articleDal.Add(product);
 }
Пример #16
0
 public void Add(Article article)
 {
     _articleDal.Add(article);
 }