Exemplo 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));
        }
Exemplo n.º 2
0
        public async Task <ActionResult <EventDto> > Put(int id, [FromBody] EventFormDto dto)
        {
            var eventInfo = await _eventInfoService.GetEventInfoByIdAsync(id);

            if (eventInfo.Archived)
            {
                return(NotFound());
            }
            dto.CopyTo(eventInfo);
            await _eventManagementService.UpdateEventAsync(eventInfo);

            return(Ok(new EventDto(eventInfo)));
        }