Krishna Kumar

Krishna Kumar

  • NA
  • 135
  • 36.8k

calling webapi controller from aspx page

Dec 26 2016 6:04 AM
 
 
Hi ,
 i have the below controller
 
[HttpPost, Route("EmployeeProfile")]
public HttpResponseMessage Create(HR_EmployeeProfile EmployeeProfile)
{
return Request.CreateResponse(HttpStatusCode.OK, _EmployeeProfileManager.Create(EmployeeProfile));
}
 
 
and i have the below aspx page
 
protected void BtnSaveEmpDet_Click(object sender, EventArgs e)
{
 
var emp = new EmployeeProfile(); 
   
emp.MiddleName = txtMiddleName.Text;
emp.LastName = txtLastname.Text;
emp.Add_Street1 = txtAddStreet1.Text;
emp.Add_Street2 = txtAddStreet2.Text;
emp.Add_City = txtAddCity.Text;
emp.Add_State = txtAddState.Text;
emp.Email = txtEmail.Text;
 
 where EmployeeProfile is a model and i am assigning the input values from textboxes and assigning them to the field values in the model.  Now, i want to send the emp object to the controller for creating the profile.
how could i do that? 
 
 
 
 

Answers (5)