//[HttpPost]
public async Task<ActionResult> AddEmp(MyObj myObj)
{
try
{
var apiResult= await SendToApi(HttpVerbs.Post, "Employee/AddEmp", myObt);
if (apiResult.IsSuccessStatusCode)
{
try
{
return new HttpStatusCodeResult(HttpStatusCode.OK);
}
catch (Exception ex)
{
Response.StatusCode = (int)HttpStatusCode.BadRequest;
return Json(ex.BrokenRules);
}
return new HttpStatusCodeResult(HttpStatusCode.OK);
}
// If Failed return status code and the Broken rules
Response.StatusCode = (int)apiResult.StatusCode;
return Json(apiResult.Content.ReadAsAsync<List<CustomRule>>().Result);
}
catch (Exception ex)
{
Response.StatusCode = (int)HttpStatusCode.BadRequest;
return Json(ex.CustomRule);
}
}