public ActionResult Create(RegistryEventCreate model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var service = CreateRegistryEventService();

            if (service.CreateRegistryEvent(model))
            {
                // Use TempData rather than ViewBag. TempData removes information after it's accessed
                TempData["SaveResult"] = "Your Event was created.";
                return(RedirectToAction("Index"));
            }

            ModelState.AddModelError("", "Your Event could not be created.");
            return(View(model));
        }
        public bool CreateRegistryEvent(RegistryEventCreate model)
        {
            var entity =
                new RegistryEvent()
            {
                UserProfileId            = (int)_thisUserProfileId,
                RegistryEventTitle       = model.RegistryEventTitle,
                RegistryEventDescription = model.RegistryEventDescription,
                EventLocation            = model.EventLocation,
                EventDate = model.EventDate
            };

            using (var ctx = new ApplicationDbContext())
            {
                ctx.RegistryEvents.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }