public int Create(List <ExampleEntity> entities) { _logger.LogDebug("Create"); if (entities.Any(x => string.IsNullOrEmpty(x.Name))) { _logger.LogWarning("Missing required property 'Name'"); return(0); } var filteredEntities = entities.Where(x => x.Id == 0).ToList(); var entitiesToCreate = filteredEntities.Select(e => _mapper.Map <ExampleModel>(e)).ToList(); var result = _repository.Create(entitiesToCreate); _logger.LogDebug($"Create: {result} entities created"); return(result); }
public async Task <bool> Create(Example newEntity) { return(await _exampleRepository.Create(newEntity)); }
/// <summary> /// Create /// </summary> /// <param name="data">The record passed in.</param> /// <returns>The record created for the result.</returns> public ExampleModel Create(ExampleModel data) { var myData = repository.Create(data); return(myData); }