Angular newbie and I have had no luck getting to the bottom of this one. I 
am trying to send an update call to my RESTful web service. I am passing 
and int and an object. When debugging back at the web service, the int 
comes in fine, however the object always come is as NULL. Debugging before 
the call is made shows that the object has a value. Why am I getting NULL 
for my object in the web service?

I have tried making the call from a factory as well as the save function. 
Both are null when the web service is called.

*app.js*

TournamentDirectorApp.factory('tournamentFactory', function () {
    return {
        addUserToTournament: function (id, tourney, user, Tournament) {
            tourney.Users.push(user)
            var response = Tournament.update({ id: id }, { tourney: tourney })
            return tourney;
        }
    };
 });

$scope.save = function () {
    var updatedTournament = tournamentFactory.addUserToTournament(id, 
selectedTourney, $scope.selectedUser, Tournament);

    Tournament.update({ id: id }, { tournament: updatedTournament }, function 
() {
        $location.path('/')
    });
};

*web service*

    public HttpResponseMessage PutTournament(int id, Tournament tournament)
    {
        if (ModelState.IsValid && id == tournament.TournamentId)
        {
            db.Entry(tournament).State = EntityState.Modified;
            db.SaveChanges();
            return Request.CreateResponse(HttpStatusCode.OK);
        }
        else
        {
            return Request.CreateResponse(HttpStatusCode.BadRequest);
        }
    }

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to