public async Task <ActionResult> UpdateViewQA(string search) { var nhnch = new NHibernateNonCatalogStore(); var employees = new NHibernateCompanyStore(); var category = new NHibernateCategoryStore(); var supplier = new NHibernateISupplierStore(); IList <NonCatalogItemHeadModel> nonCatalogHeads = null; ViewData["Categories"] = await category.GeatAllCategoryAsync(); ViewData["pageName"] = "QuoteAnalysisUV"; ViewData["employees"] = await employees.GetAllEmployeeAsync(); ViewData["supplier"] = await supplier.GeatAllSupplierAsync(); ViewData["brand"] = await supplier.GeatAllBrandAsync(); long id; if (search == null) { nonCatalogHeads = await nhnch.FindLatestNonCatalogHeadAsync(10); } else if (long.TryParse(search, out id)) { nonCatalogHeads = await nhnch.FindIdNonCatalogHeadListAsync(id); } else { nonCatalogHeads = await nhnch.SearchNonCatalogByNameAsync(search); } return(View(nonCatalogHeads)); }
public async Task <ActionResult> NonCatalogSearch(SearchItemViewModel value) { var his = new NHibernateNonCatalogStore(); value.searchItem = value.searchItem ?? ""; ViewData["ItemImagePath"] = Config.GetAppSetting("ItemImagePath"); int result; var isNumber = int.TryParse(value.searchItem, out result); IList <NonCatalogItemHeadModel> search = null; if (isNumber) { search = await his.FindIdNonCatalogHeadListAsync(result); } else { search = await his.SearchNonCatalogByNameAsync(value.searchItem); } return(PartialView(search)); }