예제 #1
0
        public ServiceType Get(int id)
        {
            var typeServiceRepo = _repository.Get(id);

            return(new ServiceType
            {
                Id = typeServiceRepo.Id,
                Description = typeServiceRepo.Description
            });
        }
예제 #2
0
        public Service Get(int id)
        {
            var serviceRepo     = _serviceRepository.Get(id);
            var serviceTypeRepo = _serviceTypeRepository.Get(serviceRepo.TypeId);

            return(new Service
            {
                Id = serviceRepo.Id,
                Description = serviceRepo.Description,
                Price = serviceRepo.Price,
                Type = new ServiceType
                {
                    Id = serviceTypeRepo.Id,
                    Description = serviceTypeRepo.Description
                }
            });
        }
예제 #3
0
        public void ServiceTypeServiceGetAreEqual()
        {
            Data.Models.ServiceType retourRepositiry = new Data.Models.ServiceType()
            {
                Id = 42, Description = "toto"
            };
            Business.DTOs.ServiceType retourService = new Business.DTOs.ServiceType()
            {
                Id = 42, Description = "toto"
            };

            A.CallTo(() => _repository.Get(0)).WithAnyArguments().Returns(retourRepositiry);
            _service = new ServiceTypeService(_repository);

            var serviceType = _service.Get(42);

            Assert.AreEqual(retourService.Id, serviceType.Id);
            Assert.AreEqual(retourService.Description, serviceType.Description);
        }
예제 #4
0
        public void UpdateServiceType(Dtos.UpdateServiceTypeInput input)
        {
            //We can use Logger, it's defined in ApplicationService base class.
            //ERROR: Logger doesn't exist in ApplicationService base Logger.Info("Updating a task for input: " + input);

            //Retrieving a task entity with given id using standard Get method of repositories.
            var type = _serviceTypeRepository.Get(input.Id.Value);

            //Updating changed properties of the retrieved task entity.
            //if (input.FirstName != string.Empty) customer.FirstName = input.FirstName.Value;
            type.Code        = input.Code;
            type.Description = input.Description;
            type.IsDeleted   = input.IsDeleted;
            //customer.Id = _productRepository.Load(input.AssignedPersonId.Value);
            //customer.Purchases = _productRepository.Load(input.CustomerId.Value);

            //We even do not call Update method of the repository.
            //Because an application service method is a 'unit of work' scope as default.
            //ABP automatically saves all changes when a 'unit of work' scope ends (without any exception).
        }