public IActionResult Add([FromBody] ArticleDto article)
        {
            var methodname = "SearchInContent";

            try
            {
                var id = _articleManager.Add(article);
                _logManager.Info(controllername, methodname, "Method başarılı şekilde çalışmıştır", username);

                if (id != 0)
                {
                    return(Ok(new { Id = id }));
                }
                else
                {
                    throw new Exception("Ekleme işleminde kaydetme sırasında hata");
                }
            }
            catch (Exception ex)
            {
                var parameters = article.GetParameters();
                _logManager.Error(controllername, methodname, ex, "Beklenmedik bir hata", username, parameters);
                return(BadRequest("Beklenmedik bir hata oluştu."));
            }
        }
示例#2
0
        protected void addArticleButton_Click(object sender, EventArgs e)
        {
            ArticleEntity article = new ArticleEntity()
            {
                Title       = this.title.Text,
                Content     = this.content.Text,
                AuthorName  = Membership.GetUser().UserName,
                Source      = this.source.Text,
                Link        = this.link.Text.Trim(),
                Image       = this.image.Text.Trim(),
                NodeId      = this.nodeId,
                FullNodeIds = node.FullIdsStringType
            };

            ArticleManager articleManager = new ArticleManager("EFConnectionString");

            articleManager.Add(article);

            this.Response.Write("<script>alert('添加文章成功!');</script>");
            this.Response.Write("<script>window.location = 'add_info.aspx';</script>");
        }
示例#3
0
 public async Task Add(ArticleDtoAdd model)
 {
     await _articleManager.Add(model);
 }