Hi
I have below Api but i want only 3 values ID,Name,DepartmentId to be passed in Body to this Api with Encrytion
How it can be done.
[HttpPost]
[ResponseType(typeof(Employee))]
public HttpResponseMessage PostEmployee([FromBody]Employee employee)
{
try
{
db.Employees.Add(employee);
db.SaveChanges();
var message = Request.CreateResponse(HttpStatusCode.Created, employee);
message.Headers.Location = new Uri(Request.RequestUri + employee.ID.ToString());
return message;
}
catch (Exception ex)
{
return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex);
}
}
-------------------------------------
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; }
}
Thanks

Sachin SinghRank #66 · 26.2K reputationPosted Feb 25, 2021, 12:05 PM EST
Ramco RamcoRank #462 · 5.4K reputationPosted Feb 26, 2021, 4:03 AM EST
Sachin SinghRank #66 · 26.2K reputationPosted Feb 26, 2021, 4:08 AM EST