예제 #1
0
        public JsonResult Delete(string id)
        {
            try
            {
                if (id == "all")
                {
                    _logServices.RemoveAll();

                    AR.SetSuccess("已清空所有日志");
                    return(Json(AR));
                }
                else
                {
                    int logId;
                    Int32.TryParse(id, out logId);
                    _logServices.Delete(logId);

                    AR.SetSuccess("已成功删除日志");
                    return(Json(AR));
                }
            }
            catch (Exception ex)
            {
                AR.Setfailure(ex.Message);
                return(Json(AR));
            }
        }
        public JsonResult Delete(string id)
        {
            if (id == "all")
            {
                bool count = _logServices.RemoveAll();
                if (count)
                {
                    AR.SetSuccess("已清空所有日志");
                    return(Json(AR, JsonRequestBehavior.DenyGet));
                }
            }
            else
            {
                int logId;
                Int32.TryParse(id, out logId);
                _logServices.Delete(logId);

                AR.SetSuccess("已成功删除日志");
                return(Json(AR, JsonRequestBehavior.DenyGet));
            }

            AR.Setfailure("删除日志失败");
            return(Json(AR, JsonRequestBehavior.DenyGet));
        }