Example #1
0
        public async Task <IActionResult> DeleteRange(IEnumerable <int> items)
        {
            var itemsDelete = await _base_repository.GetRangeById(items);

            if (itemsDelete.Any())
            {
                await _base_repository.RemoveRange(itemsDelete);

                return(NoContent());
            }
            return(NoContent());
        }
        public async Task <ActionResult <EventUser> > Delete(int eventId)
        {
            try
            {
                var result = await _eventUserRepository.GetAll(f => f.Where(x => x.EventId == eventId));

                if (result.Any())
                {
                    await _eventUserRepository.RemoveRange(result);

                    return(Ok());
                }

                return(NotFound());
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"{LocalLog} [Delete] [EventId: {eventId}]");
                throw ex;
            }
        }