Bongani Gumede

Bongani Gumede

  • NA
  • 63
  • 17.6k

Lambda expression good people please help me on the follow

Jul 20 2018 1:47 AM
if (collection["Department"] == "" || collection["Department"] == null || collection["Department"] == "0")
{
var Department = (from x in db.Departments
where x.Id == 1
orderby x.description ascending
select x.Id).First();
Result.DepartmentId = Department;
}
else
{
var Department = (from x in db.Departments
where x.description == collection["Department"]
orderby x.description ascending
select x.Id).First();
Result.DepartmentId = Department;
}

Answers (3)