I have the below code which is returning me a model from database. I want to know how many records are written. I am trying to use model.count or model.lenght but its not working.
var model = await _repository.GetEmployees(name);
GetEmployees method is defined as follows:
public async Task<IEnumerable<Employee>> GetEmployees(string name)
{
return await _dbContext.Employee
.Where(c => c.EmpName == name).ToListAsync();
}
I need to know the count of records.
add System.Linq to your usings. It will give an extension method to all IEnumerables called Count()