Ejemplo n.º 1
0
        public ActionResult Create(Event_RegistrationViewModel eventRegVM)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var eventRegDB = new Event_Registration();
                    eventRegDB = Mapper.Map <Event_RegistrationViewModel, Event_Registration>(eventRegVM);

                    AnimalRescueEntities svc = new AnimalRescueEntities();
                    svc.AddToEvent_Registration(eventRegDB);

                    // Send the insert to the data service.
                    svc.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }