In .net core project and postgresql db I am joining 3 tables. I am trying to get enum values in this join. My join looks like
[HttpGet]
public IActionResult GetVMs()
{
var model =
from vm in _context.VirtualMachines
join project in _context.Projects on vm.ProjectId equals project.Id
join hypervisor in _context.Hypervisors on vm.HypervisorId equals
hypervisor.HypervisorId
join managment in _context.Managements on vm.ManagementId equals managment.Id
select new
{
Name = vm.Name,
IpAddress = vm.IpAddress,
DiskSize = vm.DiskSize,
Cpu = vm.CPU,
Ram = vm.Ram,
ImageUrl = vm.ImageUrl,
Role = vm.Role,
Status = vm.Status,
Project = project.Name,
Hypervisor = hypervisor.Name,
Gateway = managment.Gateway,
Netmask = managment.Netmask
};
return Ok(model);
}
I am getting back in postman
{
"name":"Abstergo",
"ipAddress":"192.168.0.1",
"diskSize":25,
"cpu":16,
"ram":100,
"imageUrl":"www.google.com",
"role":1,
"status":0,
"hypervisorId":1,
"projectId":11,
"managementId":8
}
How to show role and status enum values?