Ejemplo n.º 1
0
        public ActionResult Delete(int id)
        {
            AjaxResult result = new AjaxResult();

            try
            {
                LinksClass entity = m_FTISService.GetLinksClassById(id);

                //檢查底下的Links數量
                IDictionary <string, string> conditions = new Dictionary <string, string>();
                conditions.Add("LinksClassId", id.ToString());
                int subsCount = m_FTISService.GetLinksCount(conditions);
                if (subsCount > 0)
                {
                    return(this.Json(new AjaxResult(AjaxResultStatus.Fail, string.Format("{0}底下尚有網路資源,不可刪除。", entity.Name))));
                }

                m_FTISService.DeleteLinksClass(entity);

                result.ErrorCode = AjaxResultStatus.Success;
                result.Message   = string.Format("{0}刪除成功", entity.Name);
            }
            catch (Exception ex)
            {
                result.ErrorCode = AjaxResultStatus.Exception;
                result.Message   = ex.Message;
            }

            return(this.Json(result));
        }