Ejemplo n.º 1
0
        public Task <List <GetAllEstablishmentsQueryResponse> > Handle(GetAllEstablishmentsQuery request, CancellationToken cancellationToken)
        {
            var establishments = _repository.GetAll().ToList();

            var allEstablishments = new List <GetAllEstablishmentsQueryResponse>();

            foreach (var establishment in establishments)
            {
                allEstablishments.Add(
                    new GetAllEstablishmentsQueryResponse(
                        establishment.Id,
                        establishment.Name,
                        establishment.CNPJ,
                        establishment.Address.ToString(),
                        establishment.Phone,
                        establishment.CarsCapacity,
                        establishment.MotorcyclesCapacity
                        )
                    );
            }
            ;

            return(Task.FromResult(allEstablishments));
        }
Ejemplo n.º 2
0
 public IEnumerable <Establishment> Get()
 {
     return(_establishmentRepository.GetAll());
 }