public IActionResult Index() { FindProductInfoViewModel createFindProductModel = new FindProductInfoViewModel(); List <FindProductInfoViewModel> mostRecentList = createFindProductModel.FindMostRecentListings(); return(View(mostRecentList)); }
public IActionResult ListingCheck(FindProductInfoViewModel productinfo) { ViewBag.Product = productinfo.ProductTitle; var listingcheck = new FindProductInfoViewModel(); var newcheck = listingcheck.FindMatchingProductInfo(productinfo).FirstOrDefault(); var viewcheck = new ConversionProduct(); if (newcheck != null) { return(View("~/Views/Store/Listing.cshtml")); } return(View("~/Views/Store/SellerSearch.cshtml")); }
public IActionResult Catalog() { cd.SneakerDropDbContext db = new cd.SneakerDropDbContext(); var sessionproduct = HttpContext.Session.GetString("ProductName"); var model = new FindProductInfoViewModel { ProductTitle = sessionproduct }; List <FindProductInfoViewModel> results = model.FindMatchingProductInfo(model); var createcatalog2 = db.Type.Where(t => t.TypeName.Contains(sessionproduct)).ToList(); List <FindProductInfoViewModel> onlyType = new List <FindProductInfoViewModel>(); if (results == null) { foreach (var item1 in createcatalog2) { var typeid = item1.TypeId; var createcatalog3 = db.ProductInfos.Where(p => p.Type.TypeId == typeid).ToList(); var typeList = model.ConvertListOnly(createcatalog3); onlyType.AddRange(typeList); } return(View("~/Views/Store/Catalog.cshtml", onlyType)); } foreach (var item2 in createcatalog2) { var typeid = item2.TypeId; var createcatalog3 = db.ProductInfos.Where(p => p.Type.TypeId == typeid).ToList(); var typeList = model.ConvertListOnly(createcatalog3); results.AddRange(typeList); } // for if user inputs something that doesnt exist in db if (results.Count == 0 && createcatalog2.Count == 0) { return(View("~/Views/Store/SellerCatalog.cshtml", onlyType)); } return(View("~/Views/Store/Catalog.cshtml", results)); }
public IActionResult SingleItem(FindProductInfoViewModel productinfo) { return(View("~/Views/Store/SingleItem.cshtml")); }
public IActionResult buyeritem(FindProductInfoViewModel productinfo) { return(RedirectToAction("SingleItem", "Home", productinfo.ProductTitle)); }