0
I have an Application Service in ASP.NET Core that will fetch the database data from a table "Employees" that are number, name, departmentname and cityname... the last two fields I mentioned are data from two other tables "Department" and "City". And the "Employees" table has two foreign keys to "Department" and "City".
I made a method
namespace access.track.Logicpulse {
public interface IEmployeesAppService : IApplicationService
{
ListResultDto<EmployeesListDto> GetEmployees(GetEmployeesInput input); }
that will fetch all Employees by departmentname.
public ListResultDto<EmployeesListDto> GetEmployees(GetEmployeesInput input)
{
var emp = _employeesRepository
.GetAll()
.WhereIf(
!input.Filter.IsNullOrEmpty(),
p => p.DepartmentFk.name.Contains(input.Filter)
)
.OrderBy(p => p.DepartmentFk.name)
.ToList();
return new ListResultDto<EmployeesListDto>(ObjectMapper.Map<List<EmployeesListDto>>(emp));
}
Now what happens is that the departmentname and cityname fields see the "null" of the Web API when I call the method.
I have an idea it’s because of this... but I don’t know what to do with the departmentname and cityname fields... what kind of data to use? (You’re probably asking the wrong question...)
namespace access.track.Logicpulse.Dtos {
public class EmployeesListDto
{
public int number { get; set; }
public string name { get; set; }
public string departmentname { get; set; }
public string cityname { get; set; }
}}
What data type does Getall() return? Iqueryable?
– Marco Antonio Quintal
Iqueryable<Employees>
– João Marques