public ActionResult searchseeds(string SeedName) { Search search = (Search)Session["Search"]; if (search != null) { if (SeedName != null) { if (SeedName == string.Empty) { return(RedirectToAction("productseeds")); } else { int count = 0; int Coun = int.Parse(search.CId); int Div1 = int.Parse(search.DId); int Edition = int.Parse(search.EId); var Ind = from plm_vw in db.Seeds select plm_vw; if (!string.IsNullOrEmpty(SeedName)) { Ind = Ind.Where(s => s.SeedName.StartsWith(SeedName)); foreach (Seeds J in Ind) { count = count + 1; } ViewData["Count"] = count; } SearchSeeds SearchSeed = new SearchSeeds(SeedName); Session["SearchSeeds"] = SearchSeed; return(View("productseeds", Ind)); } } else { SearchSeeds Sr = (SearchSeeds)Session["SearchSeeds"]; int count = 0; var Ind = from plm_vw in db.Seeds select plm_vw; if (!string.IsNullOrEmpty(Sr.SeedName)) { Ind = Ind.Where(s => s.SeedName.StartsWith(Sr.SeedName)); foreach (Seeds J in Ind) { count = count + 1; } ViewData["Count"] = count; } return(View("productseeds", Ind)); } } return(View()); }
public ActionResult searchs(string SeedName) { int count = 0; if (SeedName != null) { if (SeedName == string.Empty) { return(RedirectToAction("productseeds")); } else { ClasificationProds CPPC = (ClasificationProds)Session["ClasificationProds"]; int?ProdIdC = CPPC.PId; var PSeeds = db.Database.SqlQuery <Seeds>("plm_spGetPPSeedsSearch @ProductId=" + ProdIdC + ", @param='" + SeedName + "'").ToList(); foreach (Seeds S in PSeeds) { count = count + 1; } ViewData["Count"] = count; SearchSeeds searchseed = new SearchSeeds(SeedName); Session["searchseed"] = searchseed; return(View("productseeds", PSeeds)); } } else if (SeedName == null) { SearchSeeds Sr = (SearchSeeds)Session["searchseed"]; var Ind = from seed in db.Seeds select seed; if (!string.IsNullOrEmpty(Sr.SeedName)) { Ind = Ind.Where(s => s.SeedName.StartsWith(Sr.SeedName)); foreach (Seeds J in Ind) { count = count + 1; } ViewData["Count"] = count; } return(View("productseeds", Ind)); } return(View()); }