var NotesSvc = function() {
    var service = {
        getNotes: function (nbItems, index) {
            var notes = [];
            for (var i = 0; i < nbItems; i++) {
                notes.push({
                    id: parseInt(index + i),
                    titre: "Note " + parseInt(index + i),
                    description: "Description de la note " + parseInt(index + i),
                    evaluation: 3
                });
            }
            return notes;
        },
        getNote: function (id) {
            return {
                    id: id,
                    titre: "Note " + id,
                    description: "Description de la note " + id,
                    evaluation: 3
            };
        },
        deleteNote: function (id) {
            var index = -1;
            for (var i = 0; i < notes.length; i++) {
                if (notes[i].id === id) {
                    index = i;
                    break;
                }
            }

            if (index !== -1) {
                notes.splice(i, 1);
            }
        }
    };

    return service;
};