Ejemplo n.º 1
0
 // DELETE: api/LeaveRequests/5
 public HttpResponseMessage DeleteLeaveRequest(int id)
 {
     try
     {
         var message = Request.CreateErrorResponse(HttpStatusCode.NotFound, "404 : Data Not Found");
         var result  = iLeaveRequestService.Delete(id);
         if (result)
         {
             message = Request.CreateResponse(HttpStatusCode.OK, "200 : OK (Data Deleted)");
         }
         return(message);
     }
     catch (Exception e)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500 : Internal Server Error"));
     }
 }
        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            var dialogResult = MessageBox.Show("Are you sure?", "Delete Confirmation", MessageBoxButton.YesNo).ToString();

            if (dialogResult == "Yes")
            {
                var result = iLeaveRequestService.Delete(Convert.ToInt32(_fromRequestId));
                if (result)
                {
                    MessageBox.Show("Delete Successfully");
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("Delete Fail");
                }
            }
        }