Ejemplo n.º 1
0
        public async Task <EventDto> Post([FromBody] EventFormDto dto)
        {
            var eventInfo = new EventInfo();

            dto.CopyTo(eventInfo);
            await _eventManagementService.CreateNewEventAsync(eventInfo);

            return(new EventDto(eventInfo));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(await PageAsync());
            }

            if (!User.IsInRole(Roles.SuperAdmin))
            {
                // Force current org id to be set by all admins except
                // super admin who can choose not to bind event to the org.
                EventInfo.OrganizationId = (await _currentOrganizationAccessorService
                                            .RequireCurrentOrganizationAsync())
                                           .OrganizationId;
            }

            await _eventsService.CreateNewEventAsync(EventInfo);

            return(RedirectToPage("./Index"));
        }