Advertisement
banyucenter

Untitled

Nov 26th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // controll untuk melakukan hapus data
  2. wargaController.delete = function (req, res) {
  3.   Warga.findOne({ _id: req.params._id }, function (err, row) {
  4.     if (row) {
  5.       console.log(row);
  6.       Warga.remove({ _id: req.params._id }, function (err) {
  7.         // If error
  8.         if (err) {
  9.           console.log("Delete Warga Error", err);
  10.         }
  11.         else {
  12.           console.log("Warga deleted!");
  13.           res.redirect('http://localhost:3000');
  14.         }
  15.       });
  16.     }
  17.     else {
  18.       res.redirect('http://localhost:3000');
  19.     }
  20.   });
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement