http удалить в angularJS - PullRequest
       2

http удалить в angularJS

0 голосов
/ 26 марта 2019

Я новичок в angularJS и все еще учусь.У меня есть этот код ниже, как удалить.Но у меня ошибка

$scope.deleteEmployee = function (e) {
    console.log(e);
    var _ID = e.PersonId;
    var _url = '../Home/Delete?ID';
    $http.delete(_url, _ID).then(function (response) {
        alert(response.data.msg);
        GetList();
    });
}

Failed to load resource: the server responded with a status of 404 (Not Found) Home/Delete/?ID:1

Controller.cs Код

  public JsonResult Delete(int ID)
    {
        try
        {
            var _data = db.People.Where(a => a.PersonId == ID).SingleOrDefault();
            db.People.Remove(_data);
            db.SaveChanges();
            return Json(new { msg = "" }, JsonRequestBehavior.AllowGet);
        }
        catch (Exception ex)
        {

            return Json(new { msg = "" }, JsonRequestBehavior.AllowGet);
        }
    }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...