public ActionResult OrderSearch(helperOrderSearch pageHelper, int pageId) { topCart cartItem = (topCart)ViewData["topCart"]; pageShared ps = new pageShared(db); var pageMainAccount = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); if (cartItem.isRegisteredUser) { var pageOrderList = ps.getPageByType(pageType.accountOrders, langId); return Redirect("~/" + langCode + "/" + pageMainAccount.url + "/" + pageOrderList.url + ".html"); } var pageItem = db.tbl_page.Include("tbl_category").Where(a => a.pageId == pageId).FirstOrDefault(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.detail = pageItem.detail; pageHelper.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); var parentCategoryList = db.tbl_category.Include("tbl_page").Where(a => a.parentId == pageItem.tbl_category.parentId && a.statu).ToList(); pageHelper.leftMenuList = getStaticLeftMenu(parentCategoryList, pageId); // Redirect to Login Page With Session if (!string.IsNullOrWhiteSpace(pageHelper.toLogin)) { Session["redirectPage"] = Request.Url.ToString(); var loginPage = ps.getPageByType(pageType.registerLogin, langId); if (loginPage == null) { errorSend(new Exception("loginPage gelmemesi, checkout Step 0"), "LoginPage gelmemesi, checkout Step 0", true); return null; } return Redirect("~/" + langCode + "/" + loginPage.url + ".html"); } else // Search Order { if (ModelState.IsValid) { orderShared os = new orderShared(db); var orderItem = os.getUnregisteredOrder(pageHelper.email, pageHelper.orderNo); if (orderItem != null) { var orderDetailPage = ps.getPageByType(pageType.accountOrderDetail, langId); return Redirect("~/" + langCode + "/" + orderDetailPage.url + ".html?orderGuid=" + orderItem.orderGuid); } else { pageHelper.isMessageExist = true; pageHelper.message = getErrorMessage(lang.orderSearchNotFound); return View(pageHelper); } } else { pageHelper.isMessageExist = true; pageHelper.message = getErrorMessage(getModelStateError(ModelState)); return View(pageHelper); } } }
public ActionResult OrderSearch(int pageId) { topCart cartItem = (topCart)ViewData["topCart"]; pageShared ps = new pageShared(db); var pageMainAccount = db.tbl_page.Include("tbl_category").Where(a => a.pageTypeId == (int)pageType.account).FirstOrDefault(); if (cartItem.isRegisteredUser) { var pageOrderList = ps.getPageByType(pageType.accountOrders, langId); return Redirect("~/" + langCode + "/" + pageMainAccount.url + "/" + pageOrderList.url + ".html"); } var pageItem = db.tbl_page.Include("tbl_category").Where(a => a.pageId == pageId).FirstOrDefault(); helperOrderSearch pageHelper = new helperOrderSearch(); ps.pageTitleBind(pageItem, pageHelper, langId); pageHelper.detail = pageItem.detail; pageHelper.breadCrumbItem = getBreadCrumbStaticPage(pageItem.name); var parentCategoryList = db.tbl_category.Include("tbl_page").Where(a => a.parentId == pageItem.tbl_category.parentId && a.statu).ToList(); pageHelper.leftMenuList = getStaticLeftMenu(parentCategoryList, pageId); return View(pageHelper); }