Beispiel #1
0
        public ActionResult Create(EventViewModel Model)
        {
            tblEvent Event = new tblEvent();

            if (ModelState.IsValid)
            {
                Event = Model.As_tblEvent();
                _ODB.tblEvents.AddObject(Event);
                _ODB.SaveChanges();
                this.ShowPageMessage(String.Format("The event '{0}' was created successfully.", Event.Name));
            }
            else
            {
                this.ShowPageError(DataConstants.ModelStateInvalidError);
                return(View("Index", Model));
            }

            SecureAccess.Utilities.Logging.Log(SecureAccess.Utilities.Logging.LogType.Audit, String.Format("User {0} created an event with ID {1}; Name: '{2}.'", Current.User.Username, Event.ID, Event.Name));
            return(this.RedirectToAction <EventsController>(c => c.Event(Event.ID)));
        }