Esempio n. 1
0
        public async Task <IActionResult> DeleteEvent([FromRoute] string id)
        {
            if (!ModelState.IsValid)
            {
                _logger.LogInformation(LoggingEvents.ItemNotValid, "Item is not valid");

                return(BadRequest(ModelState));
            }

            var @event = await _service.GetById(id);

            if (@event == null)
            {
                _logger.LogInformation(LoggingEvents.GetItemNotFound, "Item not exists");

                return(NotFound());
            }

            _service.Delete(@event);
            await _service.Save();

            return(Ok(@event));
        }