/// <summary>
        /// Get Schedule Information
        /// </summary>
        /// <param name="eventDefinitionId"></param>
        /// <returns></returns>
        public Schedule GetScheduleInformation(int eventDefinitionId)
        {
            var eventDefinition     = _eventDefinitionRepository.GetById(eventDefinitionId);
            var mapper              = new EventDefinitionToScheduleViewModelMapper();
            var scheduleInformation = mapper.Map(this.GetRegisteredUserId(), eventDefinition);

            return(scheduleInformation);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Detail view action
        /// </summary>
        /// <param name="identity"></param>
        /// <param name="eventDefinitionId"></param>
        /// <returns></returns>
        public ActionResult Detail(MyEventsIdentity identity, int eventDefinitionId)
        {
            var eventDefinition = _eventsRepository.GetById(eventDefinitionId);

            if (null == eventDefinition)
            {
                throw new HttpException("404");
            }

            return(View(eventDefinition));
        }
Exemplo n.º 3
0
        public ActionResult Edit(MyEventsIdentity identity, int eventDefinitionId)
        {
            EventDefinition eventDefinition = _eventsRepository.GetById(eventDefinitionId);

            _authorizationService.ValidateEventAuthorization(identity, eventDefinition);

            var viewModel = new EditEventViewModel()
            {
                HasLogo = true
            };

            MapEventDefinitionToViewModel(eventDefinition, viewModel);
            ResetLogo();
            return(View(viewModel));
        }
        private void ValidateEventAuthorization(int eventDefinitionid)
        {
            var token           = MyEventsToken.GetTokenFromHeader();
            var eventDefinition = _eventDefinitionRepository.GetById(eventDefinitionid);

            if (token.RegisteredUserId != eventDefinition.OrganizerId)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Unauthorized));
            }
        }
        public ActionResult GetSheduleInfo(MyEventsIdentity identity, int eventDefinitionId)
        {
            var eventDefinition = _eventDefinitionRepository.GetById(eventDefinitionId);

            _authorizationService.ValidateEventAuthorization(identity, eventDefinition);

            var mapper    = new EventDefinitionToScheduleViewModelMapper();
            var viewModel = mapper.Map(eventDefinition);

            return(Json(viewModel, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Validates the event authorization.
        /// </summary>
        /// <param name="identity">The identity.</param>
        /// <param name="eventDefinitionid">The event definitionid.</param>
        public void ValidateEventAuthorization(MyEventsIdentity identity, int eventDefinitionid)
        {
            var eventDefinition = _eventDefinitionRepository.GetById(eventDefinitionid);

            ValidateEventAuthorization(identity, eventDefinition);
        }