Ejemplo n.º 1
0
        public PaymentView(Payment payment)
        {
            ShopRepository shopRepository;
            BasketItemRepository basketItemRepository;
            IndividualRepository individualRepository;

            shopRepository = new ShopRepository();
            individualRepository = new IndividualRepository();
            basketItemRepository = new BasketItemRepository();

            this.Id = payment.Id;
            this.isPayed = payment.isPayed;
            this.ShopId = payment.ShopId;

            if (this.ShopId != null)
                this.Shop = (Shop)shopRepository.FindById(this.ShopId);

            this.IndividualId = payment.IndividualId;
            if (this.IndividualId != null)
                this.Individual = (Individual)
                    individualRepository.FindById(this.IndividualId);

            this.BasketItems = basketItemRepository.FindBasketItemsByPayment(
                this.Id);
        }
Ejemplo n.º 2
0
        public ShopView(Shop shop)
        {
            ShopRepository shopRepository;
            AddressRepository addressRepository;
            CityRepository cityRepository;
            StreetRepository streetRepository;
            StreetTypeRepository streetTypeRepository;

            shopRepository = new ShopRepository();
            addressRepository = new AddressRepository();
            cityRepository = new CityRepository();
            streetRepository = new StreetRepository();
            streetTypeRepository = new StreetTypeRepository();

            this.Id = shop.Id;
            this.Name = shop.Name;
            this.BookDeliveryCost = shop.BookDeliveryCost;
            this.Address = (Address)addressRepository.FindById(this.Id);
            this.City = (City)cityRepository.FindById(this.Address.CityId);
            this.Street = (Street)streetRepository.FindById(this.Address.StreetId);
            this.StreetType = (StreetType)
                streetTypeRepository.FindById(this.Street.StreetTypeId);
        }