public Rsvp AttendDinner(Rsvp rsvp)
 {
     var client = GetAuthorizedHttpClient();
     HttpContent content = CreateRsvpContent(rsvp);
     var response = client.Post(BaseUri + "Rsvp/", content);
     return GetSingleRsvpFromResponse(response);
 }
        public Rsvp CreateRsvp(Rsvp rsvp)
        {
            if (_dinners.Where(a => a.DinnerId == rsvp.DinnerId).Count() > 0)
                throw new Exception(string.Format("Rsvp with Id:{0} already exists", rsvp.RsvpId));

            _rsvps.Add(rsvp);
            return rsvp;
        }
 /// <summary>
 /// Creates an RSVP for a dinner
 /// </summary>
 /// <param name="rsvp">
 /// The rsvp object
 /// </param>
 /// <returns>
 /// The updated rsvp object
 /// </returns>
 public Rsvp CreateRsvp(Rsvp rsvp)
 {
     using (NerdDinnersDb nerdDinnersDb = new NerdDinnersDb())
     {
         nerdDinnersDb.RSVPs.Add(rsvp);
         nerdDinnersDb.SaveChanges();
         return rsvp;
     }
 }
        public PartialViewResult Attend(int id)
        {
            var dinner = this._nerdDinnerService.GetDinner(id);
            this.ViewBag.UserButtonVisibility = NerdDinnerSecurity.CanEditDinner(dinner) ? "visible" : "hidden";

            var rsvp = new Rsvp() { AttendeeEmail = NerdDinnerSecurity.CurrentUserEmail(), DinnerId = id };
            rsvp = this._nerdDinnerService.AttendDinner(rsvp);

            return PartialView("_DinnerDetails", dinner);
        }
 private HttpContent CreateRsvpContent(Rsvp rsvpToUpdate)
 {
     DataContractSerializer singleSerializer = new DataContractSerializer(typeof(Rsvp));
     HttpContent content = rsvpToUpdate.ToContentUsingDataContractSerializer(singleSerializer);
     content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/xml");
     return content;
 }