Пример #1
0
        public async Task <ActionResult <Event> > CreateEvent([FromBody] Event anEvent)
        {
            try
            {
                Event createdEvent = await _context.CreateEvent(anEvent);

                return(CreatedAtRoute(nameof(GetEvent), new { id = createdEvent.Id }, createdEvent));
            }
            catch (ControllerNotFoundException e)
            {
                return(NotFound(e.Message));
            }
            catch (ControllerBadRequestException e)
            {
                return(BadRequest(e.Message));
            }
        }