0

I use HttpClient with ASP to consume services in a remote database In my ASP controller (Collaborateur), I have the following code:

        public Boolean UpdateCollaborateur(Collaborateur collaborateur) {

            using (var client = new HttpClient()) {

                (.......)
            }
            return true;

        }

Then in my angular service, i have the following call:

.factory('UpdateCollaborateur', function ($http) {
    var fac = {};
    fac.Update = function (collaborateur) {
        return $http.put('/Collaborateur/UpdateCollaborateur/'+collaborateur);

    };
    return fac;
})

By putting a breakpoint , why i can not access in my function UpdateCollaborateur after executing my method in my controller angularjs? Thanks for your help

ALFA
  • 263
  • 1
  • 5
  • 20

1 Answers1

0

I may be wrong but shouldn't it be:
return $http.put('/Collaborateur/UpdateCollaborateur/', collaborateur);

You have a + instead of a ,.

You also likely need the [HttpPut] attribute on the method.

NOTE: HTTP PUT not allowed in ASP.NET Web API

Community
  • 1
  • 1
Devon Burriss
  • 2,497
  • 1
  • 19
  • 21
  • another related question, how do I do if I want to pass two or multiple parameter in my fonction – ALFA Nov 09 '15 at 15:49
  • Add them to the collaborateur model or add them to the query string ie. `/Collaborateur/UpdateCollaborateur/1` then update routing and the method `UpdateCollaborateur(int id, Collaborateur collaborateur)` – Devon Burriss Nov 09 '15 at 16:10