Ejemplo n.º 1
0
        public SimpleTestContainer()
        {
            var domainEventPublisher = new SimpleEventPublisher();

            var uoW = new MemoryCarRentalUoW(
                new MemoryRepository <Driver>(),
                new MemoryRepository <Car>(),
                new MemoryRepository <Rental>(),
                new MemoryRepository <Office>()
                );

            var freeMinutesPolicyFactory = new FreeMinutesPolicy();
            var rentalFactory            = new RentalFactory(domainEventPublisher);

            var carMapper    = new CarMapper();
            var driverMapper = new DriverMapper();
            var rentalMapper = new RentalMapper();
            var officeMapper = new OfficeMapper();


            DriverService       = new DriverService(uoW, driverMapper, domainEventPublisher);
            CarService          = new CarService(uoW, carMapper, domainEventPublisher);
            RentalService       = new RentalService(uoW, rentalMapper, domainEventPublisher, rentalFactory, freeMinutesPolicyFactory);
            FinishRentalService = new StopRentalService(uoW, domainEventPublisher);
            OfficeService       = new OfficeService(uoW, officeMapper, domainEventPublisher);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Update([FromBody] OfficeModel data)
        {
            var dataUpdate = await _officeService.Update(OfficeMapper.Map(data));

            return(Ok());
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Add([FromBody] OfficeModel data)
        {
            var dataEntity = await _officeService.Add(OfficeMapper.Map(data));

            return(Ok(dataEntity));
        }
Ejemplo n.º 4
0
 public OfficeService(ICarRentalUoW uoW, OfficeMapper officeMapper, IDomainEventPublisher domainEventPublisher)
 {
     _uoW                  = uoW;
     _officeMapper         = officeMapper;
     _domainEventPublisher = domainEventPublisher;
 }
Ejemplo n.º 5
0
        public async Task <Office> UpdateOffice(Office office)
        {
            var updated = await _officeRepository.Update(OfficeMapper.Map(office));

            return(OfficeMapper.Map(updated));
        }
Ejemplo n.º 6
0
        public async Task <Office> GetOffice(int id)
        {
            var entidad = await _officeRepository.Get(id);

            return(OfficeMapper.Map(entidad));
        }
Ejemplo n.º 7
0
        public async Task <Office> AddOffice(Office office)
        {
            var addedEntity = await _officeRepository.Add(OfficeMapper.Map(office));

            return(OfficeMapper.Map(addedEntity));
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> UpdateAdmin([FromBody] OfficeModel office)
        {
            var name = await _officeService.UpdateOffice(OfficeMapper.Map(office));

            return(Ok(name));
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> UpdateOffice([FromBody] OfficeModel Office)
        {
            var updatedOffice = await _officeService.UpdateOffice(OfficeMapper.Map(Office));

            return(Ok(updatedOffice));
        }
Ejemplo n.º 10
0
        public async Task <IActionResult> AddOffice([FromBody] OfficeModel Office)
        {
            var newOffice = await _officeService.AddOffice(OfficeMapper.Map(Office));

            return(Ok(newOffice));
        }
Ejemplo n.º 11
0
        public async Task <Office> Update(Office office)
        {
            var data = await _officeRepository.Update(OfficeMapper.Map(office));

            return(office);
        }
Ejemplo n.º 12
0
        public async Task <Office> Get(int id)
        {
            var office = await _officeRepository.Get(id);

            return(OfficeMapper.Map(office));
        }