Exemplo n.º 1
0
        public async Task <ActionResult> Index(EventModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var eventEntity = Mapper.Map <Event>(model);

            eventEntity = (model.Id.HasValue) ?
                          await _eventManagementService.UpdateEventAsync(eventEntity) :
                          await _eventManagementService.CreateEventAsync(eventEntity, User.Identity.GetUserId());

            return(RedirectToAction("Index", "Share", new { eventHash = eventEntity.Id.GetUniqueUrlParameter() }));
        }