Ejemplo n.º 1
0
        public JsonResult Delete(string listId)
        {
            ResultModel <bool> result     = new ResultModel <bool>();
            string             deleted    = string.Empty;
            string             notDeleted = string.Empty;

            string[] arrayId = listId.Split('_');
            for (int i = 0; i < arrayId.Length; i++)
            {
                try
                {
                    var resultDel = _menuBusiness.DeleteMenuById(long.Parse(arrayId[i]));
                    if (resultDel.IsError == false)
                    {
                        deleted = deleted + arrayId[i] + ",";
                    }
                    else
                    {
                        notDeleted = notDeleted + arrayId[i] + ",";
                    }
                }
                catch
                {
                    notDeleted = notDeleted + arrayId[i] + ",";
                }
            }
            if (deleted.Length > 0)
            {
                result.Message = "Đã xóa Ids :" + deleted;
            }
            if (notDeleted.Length > 0)
            {
                result.Message = result + "/n Lỗi xóa Ids :" + notDeleted;
            }
            return(Json(result.Message, JsonRequestBehavior.AllowGet));
        }