Ejemplo n.º 1
0
        private bool DeleteById(int id)
        {
            DataAdapter da     = new DataAdapter();
            var         result = da.DelectByID(id);

            return(result == 1);
        }
Ejemplo n.º 2
0
        private async Task DeleteById(MessageEvent mev, string[] messageSpilt)
        {
            int id;

            if (messageSpilt.Count() != 2)
            {
                await messagingClient.ReplyMessageAsync(mev.ReplyToken, new List <ISendMessage> {
                    new TextMessage("更新指令錯誤!!\n - [編號]")
                });

                return;
            }
            if (!int.TryParse(messageSpilt[1], out id))
            {
                await messagingClient.ReplyMessageAsync(mev.ReplyToken, new List <ISendMessage> {
                    new TextMessage("參數錯誤!\n輸入的編號不是數字!")
                });

                return;
            }
            DataAdapter da           = new DataAdapter();
            var         result       = da.DelectByID(id);
            var         replyMessage = "刪除失敗";

            if (result == 1)
            {
                replyMessage = "刪除成功";
            }
            await messagingClient.ReplyMessageAsync(mev.ReplyToken, new List <ISendMessage> {
                new TextMessage(replyMessage)
            });
        }