﻿function DeleteItem(id, a) {
    if (confirm('Удалить запись?')) {
        var row = $(a).closest('tr');
        debugger;
        var url = generateURL(null,'DeleteItem',id);
        $.getJSON(url, {}, function (data) {           
            row.remove();
        });
    }
}

function getModelName() {
    var path = window.location.pathname;
    var index = path.indexOf('/', 1);
    if (index == -1)
        return path;
    else
     return path.substring(0, index);
}

function generateURL(model, action, id) {
    if(model==null)
        model=getModelName();
    return model + '/' + action + '/' + id;
}
