Ejemplo n.º 1
0
        public IActionResult EditEventForm(string name)
        {
            var model = eventFormsRepo.GetByName(name + "Create");

            if (model == null)
            {
                throw new Exception("form not found");
            }
            model.Type = getEventTypeByName(name);
            var vm = Mapper.Map <EventFormData, EventFormViewModel>(model);

            return(View(vm));
        }
Ejemplo n.º 2
0
        private EventViewModel getModelByEventType(string eventType)
        {
            var       model = new EventViewModel();
            EventType type;

            if (Enum.TryParse(eventType, out type))
            {
                switch (type)
                {
                case EventType.Gig:
                    model.FormData = formsRepo.GetByName("GigCreate");
                    break;

                case EventType.ArtistIndividual:
                    model.FormData = formsRepo.GetByName("ArtistIndividualCreate");
                    break;

                case EventType.ArtistMultiple:
                    model.FormData = formsRepo.GetByName("ArtistMultipleCreate");
                    break;

                case EventType.Concert:
                    model.FormData = formsRepo.GetByName("ConcertCreate");
                    break;

                case EventType.Orchestra:
                    model.FormData = formsRepo.GetByName("OrchestraCreate");
                    break;

                case EventType.Benefit:
                    model.FormData = formsRepo.GetByName("BenefitCreate");
                    break;

                case EventType.Series:
                    model.FormData = formsRepo.GetByName("SeriesCreate");
                    break;

                case EventType.Exhibit:
                    model.FormData = formsRepo.GetByName("ExhibitCreate");
                    break;

                default:
                    model.FormData = formsRepo.GetByName("OtherCreate");
                    break;
                }

                // Set event type
                model.Listing.EventType = type;
            }
            else
            {
                model.FormData          = formsRepo.GetByName("OtherCreate");
                model.Listing.EventType = EventType.Other;
            }

            //create empty fields for view
            model.Listing.Initialize();

            return(model);
        }