Ejemplo n.º 1
0
        public IActionResult CreateEvent([FromBody] EventForCreationDto @event)
        {
            try
            {
                if (@event == null)
                {
                    _logger.LogError("Event object sent from client is null.");
                    return(BadRequest("Event object is null"));
                }

                if (!ModelState.IsValid)
                {
                    _logger.LogError("Invalid Event object sent from client.");
                    return(BadRequest("Invalid model object"));
                }

                bool succes = _eventLogic.Create(@event);

                return(Ok(true));
                //return CreatedAtRoute("CategoryById", new { id = createdEntity.id }, createdEntity);
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal server error"));
            }
        }
 public IActionResult Create([FromBody] EventDto eventDto)
 {
     _eventLogic.Create(eventDto);
     return(NoContent());
 }