public ActionResult Create(Dinners dinner) { if (ModelState.IsValid) { try { dinner.DinnerID = dinnerRepository.GetDinnerNewId() + 1; dinner.HostedBy = User.Identity.Name; RSVP rsvp = new RSVP(); rsvp.RsvpID = dinnerRepository.GetRsvpNewId() + 1; rsvp.AttendeeName = User.Identity.Name; dinner.RSVP.Add(rsvp); dinnerRepository.Add(dinner); dinnerRepository.Save(); return(RedirectToAction("Details", new { id = dinner.DinnerID })); } catch (Exception e) { //ModelState.AddRuleViolations(dinner.GetRuleViolations()); } } return(View(new DinnerFormViewModel(dinner))); }