public List <FindProductInfoViewModel> SearchFind(string Search)
        {
            var searchlist = FindProductInfoHelper.FindSearch(Search);
            List <FindProductInfoViewModel> searchconverted = createModel.MappingRecentListing(searchlist);

            return(searchconverted);
        }
Beispiel #2
0
        public IActionResult CreateListing(CreateNewListingViewModel passedInfo)
        {
            var model = new CreateNewListingViewModel();
            var id    = HttpContext.Session.GetInt32("SellingProductId");

            dm.ProductInfo productInfo = FindProductInfoHelper.SingleProductById((int)id);

            var listing = new dm.Listing
            {
                UserSetPrice = passedInfo.UserSetPrice,
                Quantity     = passedInfo.Quantity,
                Size         = passedInfo.Size,
                User         = new dm.User
                {
                    UserId = (int)HttpContext.Session.GetInt32("UserId")
                },
                ProductInfo = new dm.ProductInfo
                {
                    ProductInfoId = (int)HttpContext.Session.GetInt32("SellingProductId")
                }
            };

            model.AddListing(listing);

            return(RedirectToAction("Account", "Home"));
        }
        public List <FindProductInfoViewModel> FindMostRecentListings()
        {
            var domainList = FindProductInfoHelper.GetAllRecentProducts();
            List <FindProductInfoViewModel> convertedList = createModel.MappingRecentListing(domainList);

            return(convertedList);
        }
Beispiel #4
0
        public IActionResult Listing(string sellItem)
        {
            var productId = Int32.Parse(sellItem);

            HttpContext.Session.SetInt32("SellingProductId", productId);
            dm.ProductInfo            domainModel = FindProductInfoHelper.SingleProductById(productId);
            var                       viewModel   = new ConversionNewListing();
            CreateNewListingViewModel listing     = viewModel.MappingCreateListing(domainModel);

            return(View("~/Views/Store/Listing.cshtml", listing));
        }
        public List <FindProductInfoViewModel> FindMatchingProductInfo(FindProductInfoViewModel findProduct)
        {
            var productInfoDomainModel = createModel.MappingProductInfo(findProduct);
            var checkValidation        = validator.ValidateProductTitle(productInfoDomainModel);

            if (checkValidation)
            {
                List <dm.ProductInfo>           results          = FindProductInfoHelper.FindPossibleMatches(productInfoDomainModel);
                List <FindProductInfoViewModel> productViewModel = createModel.MappingViewInfo(results);

                return(productViewModel);
            }
            return(null);
        }
Beispiel #6
0
        public IActionResult ProductInfoView(string viewItem)
        {
            int selectedProductId;

            if (viewItem == null)
            {
                selectedProductId = Int32.Parse(HttpContext.Session.GetString("ProductId"));
            }
            else
            {
                HttpContext.Session.SetString("ProductId", viewItem);
                selectedProductId = Int32.Parse(viewItem);
            }

            var convert = new ConversionListing();

            List <dm.Listing> allListings = ListingHelper.GetAllListingsByProductInfoId(selectedProductId);

            dm.ProductInfo productInfo = FindProductInfoHelper.SingleProductById(selectedProductId);

            List <SingleProductViewModel> convertedList = convert.MappingAllViewListings(allListings);

            foreach (var item in convertedList)
            {
                item.Color        = productInfo.Color;
                item.Description  = productInfo.Description;
                item.ImageUrl     = productInfo.ImageUrl;
                item.DisplayPrice = productInfo.DisplayPrice;
                item.ReleaseDate  = productInfo.ReleaseDate;
                item.ProductTitle = productInfo.ProductTitle;
            }

            if (convertedList.Count == 0)
            {
                convertedList.Add(new SingleProductViewModel
                {
                    Color        = productInfo.Color,
                    Description  = productInfo.Description,
                    ImageUrl     = productInfo.ImageUrl,
                    DisplayPrice = productInfo.DisplayPrice,
                    ReleaseDate  = productInfo.ReleaseDate,
                    ProductTitle = productInfo.ProductTitle
                });
            }


            return(View("~/Views/Store/SingleItem.cshtml", convertedList));
        }
Beispiel #7
0
        public CreateNewListingViewModel CreateNewListing(dm.ProductInfo specificProduct)
        {
            var productInfo = FindProductInfoHelper.SingleProductInfo(specificProduct);

            return(createModel.MappingCreateListing(productInfo));
        }
        public dm.ProductInfo SelectedViewModel(FindProductInfoViewModel item)
        {
            var productDomainModel = createModel.MappingProductInfo(item);

            return(FindProductInfoHelper.SingleProductInfo(productDomainModel));
        }
Beispiel #9
0
        public void Test_GetAllRecentProducts()
        {
            var sut = FindProductInfoHelper.GetAllRecentProducts();

            Assert.NotEmpty(sut);
        }
Beispiel #10
0
        public void Test_SingleProductById()
        {
            var sut = FindProductInfoHelper.SingleProductById(productInfo.ProductInfoId);

            Assert.Equal(sut.ProductInfoId, productInfo.ProductInfoId);
        }
Beispiel #11
0
        public void Test_SingleProductInfo()
        {
            var sut = FindProductInfoHelper.SingleProductInfo(productInfo);

            Assert.NotNull(sut);
        }
Beispiel #12
0
        public void Test_FindPossibleMatches()
        {
            var sut = FindProductInfoHelper.FindPossibleMatches(productInfo);

            Assert.NotEmpty(sut);
        }