public ActionResult Create(HostDinner hostDinner)
        {
            if (ModelState.IsValid)
            {
                using (var s = db.CreateUnitOfWork())
                {
                    NerdIdentity nerd = (NerdIdentity)User.Identity;

                    DinnerRVSP rsvp = new DinnerRVSP();
                    rsvp.AttendeeName = nerd.FriendlyName;

                    CreateHostDinnerContext ctx = new CreateHostDinnerContext();
                    ctx.Bind(hostDinner)
                        .CreateHostDinner(nerd.Name,nerd.FriendlyName,rsvp);

                    s.Insert(hostDinner);
                    s.Commit();

                    return RedirectToAction("Details", new { id = hostDinner.Id });
                }
            }

            return View(new HostDinnerFormViewModel(hostDinner));
        }
Example #2
0
 public void AddRVSP(DinnerRVSP rvsp)
 {
     if (RVSPs == null)
         RVSPs = new List<DinnerRVSP>();
     RVSPs.Add(rvsp);
 }