Hi
I have below 2 classes . IN Controller Action method iwant to display only Id , Name , Email , Department Name in Get Method.
- public partial class Employee
- {
- public Employee()
- {
- CreatedOn = DateTime.Now;
- }
- public int ID { get; set; }
- public string Name { get; set; }
- public string Email { get; set; }
- public string Gender { get; set; }
- public Nullable<int> Salary { get; set; }
- public Nullable<int> DepartmentId { get; set; }
- public string Active { get; set; }
- [Display(Name = "Created On")]
- [DataType(DataType.Date)]
- [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}")]
- public Nullable
CreatedOn { get; set; } - public Nullable
UpdatedOn { get; set; } - public virtual Department Department { get; set; }
- }
- public int ID { get; set; }
- public string ShortName { get; set; }
- public string Description { get; set; }
- public virtual ICollection
Employees { get; set; }
Thanks

Sachin SinghRank #66 · 26.2K reputationPosted Feb 17, 2021, 8:59 AM EST
Ramco RamcoRank #462 · 5.4K reputationPosted Feb 17, 2021, 9:29 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Feb 17, 2021, 9:50 AM EST
Rijwan AnsariRank #82 · 24.2K reputationPosted Feb 17, 2021, 1:06 PM EST