public List <ExampleEntity> Get() { _logger.LogDebug("Get All"); var result = _repository.Get(); _logger.LogDebug($"Get All Result: {result.Count} entities"); return(result.Select(r => _mapper.Map <ExampleEntity>(r)).ToList()); }
public ExampleDto Get(Guid newGuid) { var entity = _exampleRepository.Get(newGuid); var dto = _exampleMapper.Map(entity); return(dto); }
public IActionResult Index() { //we are just returning data and because the domain contains all the business logic we can just get the model //and serialize the properties. var examples = _exampleRepository.Get(0, 10); return(new JsonResult(_mapper.Map <List <ExampleDto> >(examples))); }
public UpdateExampleResponse Process(UpdateExampleRequest request) { try { var example = _repository.Get(request.Id); example.UpdateProperty1(request.Property1); if (example.IsValid()) { _repository.Save(example); return(new UpdateExampleResponse(true)); } else { return(new UpdateExampleResponse(false, example.Errors)); } } catch (Exception ex) { var validations = new Validations(); validations.AddError(ErrorCode.Unexpected, "Unable to update example model."); return(new UpdateExampleResponse(false, validations)); } }
public Example Get(int id) { return(_exampleRepository.Get(id)); }
static void Main(string[] args) { IExampleRepository repository = CreateDefaultRepository(); var data = repository.Get(); }
public IEnumerable <Example> Get() { return(repository.Get()); }