我在Context中添加了Dbset
public Dbset<Demo> Demo{ get; set; }
Run Code Online (Sandbox Code Playgroud)
但我在这里得到编译错误,即
Error 1 Inconsistent accessibility: property type 'System.Data.Entity.DbSet<MVC.Model.Demo>' is less accessible than property 'MVC.Model.Demo' D:Files/project 210 34 MVC.Data
Run Code Online (Sandbox Code Playgroud)
这是我的模特: -
class Demo
{
[Key]
[Display(Name = "ID", ResourceType = typeof(Resources.Resource))]
public long Id { get; set;}
[Display(Name = "CountryID", ResourceType = typeof(Resources.Resource))]
public long CountryId { get; set; }
[Display(Name = "RightID", ResourceType = typeof(Resources.Resource))]
public long RightId { get; set; }
[Display(Name = "Amount", ResourceType = typeof(Resources.Resource))]
public double Amount { get; …Run Code Online (Sandbox Code Playgroud) 我通过ajax将数据发布到操作,但是问题是我无法通过控制器操作中的ajax发布数据。在调试时,该调用将转移到操作中,但是我什至没有得到任何数据,甚至没有'null'。
这是我的ajax电话,
$.ajax({
type: 'POST',
url:' @Url.Action("PostAmount", "Deal")',
data: { country: 2, amount: 4.02 },
datatype:JSON,
success: function (data) {
alert("hiiii"+data);
}
});
Run Code Online (Sandbox Code Playgroud)
和我的行动
[HttpPost]
public JsonResult PostAmount(int country,double amount)
{
AllocationViewModel mod = new AllocationViewModel();
return Json(mod);
}
Run Code Online (Sandbox Code Playgroud)