Approve multiple uses at once using Checkbox in knockout

Dec 24 2013 1:46 AM
Hi,
I have a requirement to Approve or Reject selected users at once using checkbox in knockout.

I can able to approve single user by using the below code

UserViewModel.prototype.approveFromApplied = function (user) {
    var self = this;
    user.statusId = 2;
    if (confirm('Are you sure?')) {
        $.ajax({
            url: "Home/ApproveUser",
            cache: false,
            type: "POST",
            contentType: "application/json; charset=utf-8",
            data: ko.toJSON(user),
            success: function (data) {
                self.users.remove(function (item) {
                    return item.user_id === data[0].User_ID;
                });
                var u = self._map(data);
                self.users.pushAll(u);
            },
            complete: function () {
                //twittAlert("Broker(s) Approved successfully!", "success");
            },
            error: function (parameters) {

            }
        });
    }
};
 
And I can able to show the checkbox and also done the checkAll/uncheckall functionality. But after selecting some users I need to pass those users to controller. How can I do it using knockout

can some body help on this.
Thanks in advance,
Murali Krishna. 

Answers (2)