Пример #1
0
 public OutPutDTO Delete(int id)
 {
     if (!ModelState.IsValid)
     {
         return(new OutPutDTO(false, Constants.STATUS_CODE.FAILURE, Constants.STATUS_MESSAGE.FAILURE, null));
     }
     try
     {
         roleBusiness.Delete <Role>(id);
         return(new OutPutDTO(true, Constants.STATUS_CODE.SUCCESS, Constants.STATUS_MESSAGE.SUCCESS, null));
     }
     catch (Exception ex)
     {
         return(new OutPutDTO(false, Constants.STATUS_CODE.EXCEPTION, Constants.STATUS_MESSAGE.EXCEPTION + ex.Message, null));
     }
 }
Пример #2
0
 public ActionResult Delete(int id)
 {
     try
     {
         _business.Delete(id);
         return(Json(new { State = true, Message = "删除成功" }, JsonRequestBehavior.AllowGet));
     }
     catch (AppException ex)
     {
         return(Json(new { State = false, Message = ex.Message }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception)
     {
         return(Json(new { State = false, Message = "未知错误,请联系管理人员" }, JsonRequestBehavior.AllowGet));
     }
 }