I have two projects Asp.net Core
and Asp.net Mvc
.
I wand to send data from the first project(Asp.net Core
) to the second project(Asp.net Mvc
) with angualrjs
When i run two projects ,my problem is that when I want to post Model from Asp.net Core
to ActionResult
in Asp.net Mvc
, this ActionResult
doesn't have value.
Angularjs in first project(Asp.net Core
):
$rootScope.PrintCArd2 = function () {
$scope.TblFishCar = {};
$scope.TblFishCar.IdFish = $rootScope.TblFishCarIdFish;
$http.post("http://localhost:61779/Report/GetFishReport", $scope.TblFishCar).then(function (result) {
alert("Ok2");
},
function (e) {
alert("warning"+e);
});
};
ActionResult in second projcet(Asp.net Mvc
):
public class ReportController : Controller
{
[System.Web.Http.HttpPost]
public ActionResult GetFishReport([FromBody]TblFishCar model)
{
//do something
return PartialView("_ShowReport");
}
}
angularjs calls public ActionResult GetFishReport([FromBody]TblFishCar model)
but model doesn't has value.
TblFishCar:
public partial class TblFishCar
{
public Guid IdFish { get; set; }
public int ShFish { get; set; }
public string DateFish { get; set; }
}
How can i solve this problem?