Пример #1
0
        // GET: Property
        public ActionResult Index(int id)
        {
            var carrier    = _carrierService.GetCarrier(id);
            var properties = Mapper.Map <IEnumerable <ServiceDTO>, IEnumerable <ServiceViewModel> >(_serviceService.ShowAllServicesById(carrier.Id));

            return(View(properties));
        }
Пример #2
0
        public void WhenGetCarrierById()
        {
            A.CallTo(() => _carrierService.GetCarrier(A <int> ._)).Returns(_carrier);
            var carrierById = _carrierService.GetCarrier(1);

            Assert.AreEqual("Быстрая доставка", carrierById.Name);
            Assert.AreEqual("пр-т Дзержинского 104, оф. 18", carrierById.Address);
            Assert.AreEqual("+375 29 6214177", carrierById.Phone);
            Assert.AreEqual("Быстрая доставка мелких товаров по городу.", carrierById.Description);
        }
Пример #3
0
        public ActionResult Details(int id)
        {
            var carrier = _carrierService.GetCarrier(id);

            if (carrier != null)
            {
                var carrierVM = Mapper.Map <CarrierDTO, CarrierViewModel>(_carrierService.GetCarrier(id));
                return(PartialView("_Details", carrierVM));
            }
            return(View("Index"));
        }
Пример #4
0
        public ActionResult CarrierFeedbacks(int id)
        {
            var carrier   = _carrierService.GetCarrier(id);
            var feedBacks = Mapper.Map <IEnumerable <FeedbackDTO>, IEnumerable <FeedbackViewModel> >(_feedbackService.GetProductFeedbacks(carrier.Id));

            return(View(feedBacks));
        }
Пример #5
0
        private void BuyOne(User user,
                            IEnumerable <Product> products,
                            ReadOnlyCollection <Carrier> carriers)
        {
            List <Task> tasks = new List <Task>();

            foreach (var product in products)
            {
                tasks.Add(Task.Run(() =>
                {
                    saleService.Buy(new Purchase
                    {
                        Product     = product,
                        User        = user,
                        Quantity    = 1,
                        Payment     = saleService.GetModeOfPayment(),
                        Carrier     = carrierService.GetCarrier(carriers).Name,
                        PurchasedOn = DateTime.Now
                    });
                }));
            }

            Task.WhenAll(tasks);
        }