nerddinner aplication based problem

May 11, 2009 at 4:41 PM

Hi,

I was trying to implement a possibility to UnRegister from a lets say dinner in my asp.net mvc application. I tried to use the same structure as in Register model but sth is wrong... I'm complete beginner and I can't solve it. Could anyone help me ? thanks.

 

<code>

//
        // AJAX: /Games/UnRSVPFromEvent/1

        [Authorize, AcceptVerbs(HttpVerbs.Post)]

        public ActionResult UnRegister(int id)
        {
            Game game = gameRepository.GetGame(id);
           
            if (game.IsUserRegistered(User.Identity.Name))
            {
                Rsvp rsvp = new Rsvp();
                rsvp.AttendeeName = User.Identity.Name;

                game.Rsvps.Remove(rsvp);
                gameRepository.Save();
            }

            return Content("some text.");

        }

</code>

 

 

and code from details.aspx (AJAX ):

<%= Ajax.ActionLink ( " Quit game", "UnRegister" ,"RSVP",
                                    new { id=Model.GameID },
                                    new AjaxOptions { UpdateTargetId="rsvpmsg",
                                                      OnSuccess="AnimateUnregMessage"})
                                                  %>