示例#1
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"));
        }
示例#2
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));
        }