public List<ResourceDTO> GetResourceDetail()
{
List<ResourceDTO> resources = (from f in context.Resources
join add in context.Addresses on f.ResourceId equals add.AddressTypeId
where add.AddressType == "RE"
select new ResourceDTO()
{
ResourceID = f.ResourceId,
FirstName = f.FirstName,
MiddleName = f.MiddlleName,
LastName = f.LastName,
DepartmentID = f.DepartmentId,
IsActive = f.IsActive,
SalutationID = f.SalutationId,
Notes = f.Notes,
Address = new AddressDTO()
{
AddressLine1 = add.AddressLine1,
AddressLine2 = add.AddressLine2,
AddressLine3 = add.AddressLine3,
AddressLine4 = add.AddressLine4,
AddressType = add.AddressType,
AddressTypeId = add.AddressTypeId,
City = add.City,
StateID = add.StateId,
Email = add.Email,
AlternateEmail = add.AlternateEmail,
Phone = add.Phone,
AlternatePhone = add.AlternatePhone,
CountryID = add.CountryId,
County = add.County,
Fax = add.Fax,
Zip = add.Zip
},
}).ToList();
if (resources.Count() == 0)
{
// throw new Exception(BLMessage.ResourceNotFound);
}
return resources;
}