public ActionResult Details(string company, string serial) { if (Session["countryList"] == null) { this.indexModel = new IndexModel(); Session["countryList"] = this.indexModel.country; Session["categoryList"] = this.indexModel.category; } if (Session[serial] == null) { ViewBag.Title = "Invalid URL"; ViewBag.Error = "Please dont tamper with the url"; return View("Error"); } else { DetailModel details = new DetailModel(Session[serial].ToString()); ViewBag.Title = details.details.ElementAt(0).Title; // If someone change the serial in url change the name of the company as well if (company != details.details.ElementAt(0).Title) { return RedirectToAction("details", new { company = details.details.ElementAt(0).Title, serial = serial }); } return View(details); } }
public ActionResult Index() { if (Session["countryList"] == null) { this.indexModel = new IndexModel(); Session["countryList"] = this.indexModel.country; Session["categoryList"] = this.indexModel.category; } return View(); }
public ActionResult SearchResult() { if (Session["countryList"] == null) { this.indexModel = new IndexModel(); Session["countryList"] = this.indexModel.country; Session["categoryList"] = this.indexModel.category; } Session["company"] = Request.QueryString["company"]; Session["category"] = Request.QueryString["category"]; Session["country"] = Request.QueryString["country"]; string pageNum = "1"; if (Request.QueryString["pageNum"] != null) { pageNum = Request.QueryString["pageNum"]; } SearchModel search = new SearchModel(Request.QueryString["company"], Request.QueryString["category"], Request.QueryString["country"], pageNum); return View(search); }