Exemplo n.º 1
0
        public IHttpActionResult Delete(int id)
        {
            var status = _toDoListService.Delete(id);

            if (status)
            {
                return(Ok());
            }

            return(StatusCode(HttpStatusCode.InternalServerError));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <ToDoList> > Delete(int id)
        {
            try
            {
                Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>();

                return(Ok(_service.Delete(id, userInfo.Id)));
            }
            catch (System.Exception err)
            {
                return(BadRequest(err.Message));
            }
        }
Exemplo n.º 3
0
        private void BtnDelete_Click(object sender, RoutedEventArgs e)
        {
            Button completed = (Button)sender;
            var    taskId    = completed.Tag;
            var    service   = new ToDoListService();
            var    result    = service.Delete((int)taskId);

            if (result.IsSuccessful)
            {
                //成功再改變畫面
                var index = (MenuOptions)ListMenu.SelectedIndex;
                Show(index);
            }
            else
            {
                var path = result.WriteLog();
                MessageBox.Show($"發生錯誤,請參考{path}");
            }
        }