예제 #1
0
        public async Task <List <RegistrationForViewDto> > ClearUserData(
            DataForClearingUserRegistrationDto dataForClearingUserRegistration)
        {
            var registeredEventList = await _context.Registrations
                                      .Where(r => r.ExcelId == dataForClearingUserRegistration.ExcelId).ToListAsync();

            if (registeredEventList.Count == 0)
            {
                throw new DataInvalidException("Invalid excel ID. Please re-check the excel ID");
            }
            _context.RemoveRange(registeredEventList);
            await _context.SaveChangesAsync();

            return(registeredEventList.Select(x => _mapper.Map <RegistrationForViewDto>(x)).ToList());
        }
예제 #2
0
 public async Task <ActionResult <List <RegistrationForViewDto> > > ClearUserData(DataForClearingUserRegistrationDto dataForClearingUserRegistration)
 {
     return(Ok(await _repo.ClearUserData(dataForClearingUserRegistration)));
 }