public async Task <int> CreateChoice(Library.Models.Choice choice) { if (choice is null) { throw new ArgumentNullException(nameof(choice)); } _logger.LogInformation($"Adding choice"); Entities.Choice entity = Mapper.Map(choice); _dbContext.Add(entity); await _dbContext.SaveChangesAsync(); return(choice.ChoiceId); }
public async Task <ApplicationCore.Models.Choice> AddChoiceAsync(ApplicationCore.Models.Choice choice) { if (choice is null) { throw new ArgumentNullException(nameof(choice)); } Entities.Choice entity = Mapper.Map(choice); await _context.Choice.AddAsync(entity); await _context.SaveChangesAsync(); return(Mapper.Map(entity)); }