Exemple #1
0
 public ActionResult DeleteArticle(string articleId)
 {
     try
     {
         articleManager.DeleteArticle(articleId);
         return(RedirectToAction("Success"));
     }
     catch (Exception)
     {
         throw;
     }
 }
 public void DeleteArticle(string articleId)
 {
     using (var biz = new GameBiz.Business.GameBizBusinessManagement())
     {
         biz.BeginTran();
         using (var manager = new ArticleManager())
         {
             var entity = manager.GetArticleById(articleId);
             if (entity == null)
             {
                 throw new ArgumentException("指定要删除的文章不存在");
             }
             manager.DeleteArticle(entity);
         }
         biz.CommitTran();
     }
 }
    protected void egvArticles_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int articleID           = (int)egvArticles.DataKeys[e.RowIndex].Value;
        DataActionStatus status = ArticleManager.DeleteArticle(articleID);

        switch (status)
        {
        case DataActionStatus.RelationshipExist:
            throw new HHException(ExceptionType.Failed, "此附件下存在关联数据,无法直接删除!");

        case DataActionStatus.UnknownFailure:
            throw new HHException(ExceptionType.Failed, "删除附件失败,请联系管理人员!");

        default:
        case DataActionStatus.Success:
            BindData();
            break;
        }
    }