Adalat  Khan

Adalat Khan

  • 651
  • 1.5k
  • 866.1k

Async and await Problem

Mar 2 2019 5:42 AM
I have an Asynchronous Action method in which i used async and Task. Now i want to use await statement in it but when i use await statement it gives me error. Following is my Action method:
 
public async Task<IActionResult> SearchAllEmployees()
{
var empRecord = from emp in dbContext.EmployeeGeneralDetails
                join c in dbContext.Countries on emp.EmpNationality equals c.CountryCode
                join b in dbContext.Branches on emp.EmpBranchCode equals b.BranchCode
                join d in dbContext.Departments on emp.EmpDepttCode equals d.DepartmentID
                select new RetrieveEmployeeDetails
                {
                EmpCode = emp.EmpCode,
                EmpFullName = emp.EmpFullName,
                EmpBirthDate = emp.EmpBirthDate,
                EmpGender = emp.EmpGender,
                EmpJoiningDate = emp.EmpJoiningDate,
                EmpMobileNumber = emp.EmpMobileNumber,
                EmpEmailAddress = emp.EmpEmailAddress,
                EmpPicture = emp.EmpPicture,
                CountryName = c.CountryName,
                BranchName = b.BranchName,
                DepartmentName = d.DepartmentName
                };
return PartialView(empRecord);
}
 
 
Please explain in the above Action method where i can use the await statement. 

Answers (2)