Watch this example on YouTube:
Replace
public ActionResult TestPage(TESTEntities model = null)
{
var test = (from z in model.Customers2
select z);
if (!String.IsNullOrEmpty(model.Customers2.First().CustomerFirstName))
{
test = model.Customers2.Where(s => s.CustomerFirstName != null) &&
(s => s.FirstOrDefault().ToString().Trim().Equals(model.Customers2.FirstOrDefault().CustomerFirstName.Trim()));
}
return View();
}
With
public ActionResult TestPage(TESTEntities model = null)
{
var test = (from z in model.Customers2
select z);
if (!String.IsNullOrEmpty(model.Customers2.First().CustomerFirstName))
{
//test = model.Customers2.Where(s => s.CustomerFirstName != null) &&
// (s => s.FirstOrDefault().ToString().Trim().Equals(model.Customers2.FirstOrDefault().CustomerFirstName.Trim()));
test = model.Customers2.Where(s => s.CustomerFirstName == null ? false : s.CustomerFirstName.Equals("AAA"));
}
return View();
}
No comments:
Post a Comment