Hi
I have 1 Solution with 3 NameSpaces.
Data Access Layer
public partial class Employee
{
public int ID { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string Gender { get; set; }
public Nullable Salary { get; set; }
public Nullable DepartmentId { get; set; }
public string Active { get; set; }
public Nullable CreatedOn { get; set; }
public Nullable UpdatedOn { get; set; }
//public Department Department { get; set; }
public virtual Department Department { get; set; }
}
public partial class Department
{
public int ID { get; set; }
public string ShortName { get; set; }
public string Description { get; set; }
public virtual ICollection Employees { get; set; }
}
API Controller
------------------
namespace ProjectManagement.Controllers
{
public class EmployeesController : ApiController
{
private PMDbEntities db = new PMDbEntities();
// GET: api/Employees
public IHttpActionResult GetEmployees()
{
try
{
var results = (from d in db.Employees
join f in db.Departments
on d.DepartmentId equals f.ID
select new
{
Id = d.ID,
Name = d.Name,
Department = f.Description
}).ToList();
if (results == null)
{
return NotFound();
}
return Ok(results);
}
catch (Exception)
{
return BadRequest();
}
}
}}AT Client side i want to display data using RestSharp in Jquery Datatable.
Secondly do i need to create same Models at Client Side also or i can add Reference of Data Access Layer.
Thanks
Sachin SinghPosted Feb 21, 2021, 6:41 AM
>(request);
Jignesh KumarPosted Feb 21, 2021, 5:17 AM
Rajanikant HawaldarPosted Feb 21, 2021, 4:43 AM