public void Put(EventDefinition eventDefinition) { if (eventDefinition == null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest)); } var token = MyEventsToken.GetTokenFromHeader(); if (token.RegisteredUserId != eventDefinition.OrganizerId) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Unauthorized)); } _eventDefinitionRepository.Update(eventDefinition); }
public ActionResult Edit(MyEventsIdentity identity, EditEventViewModel viewModel) { SetLogo(viewModel, ModelState); if (!ModelState.IsValid) { return(View(viewModel)); } var eventDefinition = _eventsRepository.GetById(viewModel.EventDefinitionId); _authorizationService.ValidateEventAuthorization(identity, eventDefinition); MapViewModelToEventDefinition(viewModel, eventDefinition); _eventsRepository.Update(eventDefinition); ResetLogo(); return(RedirectToAction("Index", "Home")); }