예제 #1
0
        public ArticleDeleteModel DeleteArticle(long pageID)
        {
            ArticleBusiness articleBusiness = new ArticleBusiness();

            ArticleDeleteModel articleDeleteModel = new ArticleDeleteModel();

            bool existPage = articleBusiness.ExistPageByArticleID(pageID);

            if (!existPage)
            {
                articleDeleteModel.Alerts.AlertList.Add("İçerik bulunamadı.");
                articleDeleteModel.Alerts.AlertType = Model.Base.Alerts.AlertTypes.Error;
            }
            else
            {
                try
                {
                    articleBusiness.DeleteArticle(pageID);

                    articleDeleteModel.Alerts.AlertList.Add("İçerik başarıyla silindi.");
                    articleDeleteModel.Alerts.AlertType = Model.Base.Alerts.AlertTypes.Success;
                }
                catch (Exception ex)
                {
                    articleDeleteModel.Alerts.AlertList.Add("İçerik silinemedi [ " + ex.Message + " ]");
                    articleDeleteModel.Alerts.AlertType = Model.Base.Alerts.AlertTypes.Error;
                }
            }

            articleDeleteModel.RedirectURL = "/Management/Article/Index";

            return(articleDeleteModel);
        }
예제 #2
0
 public HttpResponseMessage DeleteArticles(int id)
 {
     if ((!id.Equals(0)))
     {
         articulo = new
         {
             success = true,
             article = ArticleBusiness.DeleteArticle(id)
         };
         return(Request.CreateResponse(HttpStatusCode.OK, articulo));
     }
     return(Request.CreateResponse(HttpStatusCode.BadRequest, MsgError("Invalid Id Article", 404)));
 }