0
在MVC JsonResult残疾人专用我有一个模型类是这样的: -值是不是从角功能
public class InternShip
{
[Key]
public int ID { get; set; }
public string Name { get; set; }
public string Descr { get; set; }
public int Amount { get; set; }
public int Duration { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime ExpiryDate { get; set; }
}
现在我已经在我创建NG-click事件的看法: -
<a ng-click="IntrnDetail(r.ID)" style="cursor:pointer"><h5>{{r.Name}}</h5></a>
在点击我的价值传递给它由功能handeled我的角度文件InternShip.js: -
$scope.IntrnDetail = function (InternID) {
window.location.href = '/Home/InternDetail/' + InternID;
}
现在我的控制器(HomeController的)拥有的ActionResult(InternDetail)为: -
[HttpGet]
public JsonResult InternDetail(string InterID)
{
List<InternShip> Intern = new List<InternShip>();
int IntID = Convert.ToInt32(InterID);
using (EBContext db = new EBContext())
{
Intern = db.Interns.Where(x => x.ID == IntID).ToList();
}
return new JsonResult{ Data= Intern, JsonRequestBehavior=JsonRequestBehavior.AllowGet};
}
但问题是,虽然值内InternShip.js的InternID但在JsonResult未来(InternDetail)InterID越来越空。我不知道为什么会发生这种情况。
请帮助!
这做到了。谢谢你的解释。 – Deepak