public static string DeleteItem(int itemId, string item) { Dictionary <string, string> result = new Dictionary <string, string>() { { "id", itemId.ToString() } , { "item", item } , { "exists", "" } , { "deleted", "" } , { "error", "" } }; bool exists = false, deleted = false; string errorMsg = string.Empty; try { //delete if (itemId == 0) { errorMsg = "You must specify an item to delete."; } else { deleted = MasterData.Allocation_System_Delete(allocationSystemID: itemId, exists: out exists, errorMsg: out errorMsg); } } catch (Exception ex) { LogUtility.LogException(ex); deleted = false; errorMsg = ex.Message; } result["exists"] = exists.ToString(); result["deleted"] = deleted.ToString(); result["error"] = errorMsg; return(JsonConvert.SerializeObject(result, Formatting.None)); }