Exemplo n.º 1
0
        public IActionResult PutEvent([FromBody] EventTransferObject eventTransferObject)
        {
            var @event = _mapper.Map <Event>(eventTransferObject);

            try
            {
                _eventService.UpdateEvent(@event);
                return(Ok());
            }
            catch (AppException ex)
            {
                return(BadRequest(new { message = ex.Message }));
            }
        }
Exemplo n.º 2
0
        public IActionResult PostEvent([FromBody] EventTransferObject eventTransferObject)
        {
            var @event = _mapper.Map <Event>(eventTransferObject);

            try
            {
                // save
                _eventService.Create(@event);
                return(Ok());
            }
            catch (AppException ex)
            {
                // return error message if there was an exception
                return(BadRequest(new { message = ex.Message }));
            }
        }