Exemplo n.º 1
0
        public ActionResult Create()
        {
            EventCreateViewModel eventCreateViewModel = new EventCreateViewModel();
            Event newEvent = new Event();

            eventCreateViewModel.Event = newEvent;
            eventCreateViewModel.EndDateTimeInput = null;
            eventCreateViewModel.StartDateTimeInput = null;

            //newEvent = EventEditorSetup(newEvent);
            return View(EventEditorSetupCreate(eventCreateViewModel));
        }
Exemplo n.º 2
0
 private void DoCreateEventValidation(Event eventToValidate)
 {
     DoEventValidationBase(eventToValidate);
     TryValidateModel(eventToValidate);
 }
Exemplo n.º 3
0
        private void DoEventValidationBase(Event eventToValidate)
        {
            var type = typeof(Event);
            var metadata = ModelMetadataProviders.Current.GetMetadataForType(null, type);

            var ReoccurrenceFrameIDMetadata = metadata.Properties.First(x => x.PropertyName.Equals("ReoccurrenceFrameID"));
            string ReoccurrenceFrameIDDisplayName = ReoccurrenceFrameIDMetadata.GetDisplayName();

            //var CategoryIDMetadata = metadata.Properties.First(x => x.PropertyName.Equals("CategoryID"));
            //string CategoryIDDisplayName = ReoccurrenceFrameIDMetadata.GetDisplayName();

            if (eventToValidate.ReoccurrenceFrameID == 0)
            {
                ModelState.AddModelError("ReoccurrenceFrameID", ReoccurrenceFrameIDDisplayName + " is required.");
            }

            //if (eventToValidate.CategoryID == 0)
            //{
            //    ModelState.AddModelError("CategoryID", CategoryIDDisplayName + " is required.");
            //}
        }
Exemplo n.º 4
0
        //private void EventEditorSetupBase(EventViewModelBase eventViewModelBase, out EventViewModelBase eventViewModelBaseReturned)
        //{
        //    eventViewModelBase.ReoccurrenceFrames = unitOfWork.EventReoccurrenceFrameRepository.ReoccurrenceFrameKeyValueList();
        //    eventViewModelBase.Categories = unitOfWork.EventCategoryRepository.CategoriesSelectList(eventViewModelBase.NewEvent.EventCategories);
        //    eventViewModelBaseReturned = eventViewModelBase;
        //}

        private void DoEditEventValidation(Event eventToValidate)
        {
            DoEventValidationBase(eventToValidate);
        }