我无法在web api控制器方法(SaveDetails)中获取JSON数组参数.
这是我的代码.
JavaScript代码:
$.ajax(
{
url : "api/Test/SaveDetails",
type : "POST",
data : {
"employees":
[
{ "firstName": "John", "lastName": "Doe" },
{ "firstName": "Anna", "lastName": "Smith" },
{ "firstName": "Peter", "lastName": "Jones" }
]
},
success: function (data) {alert("success");},
error: function () {alert("Error");}
})
控制器方法
[HttpPost]
public DataSet SaveDetails(Models.Person[] obj)
{
//save opertion.
}
Run Code Online (Sandbox Code Playgroud)
模型方法:
public class Person
{
public string firstName { get; set; }
public string lastName { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
在web api方法中获取JSON数组参数有哪些更改.
我有一个扩展的.NET核心项目.xproj.当我在VS 2017中打开项目时,项目文件.xproj migrated to .csproj.
如何打开.xproj文件Visual Studio 2017/2015?
我需要安装任何工具吗?
当我试图在VS2015中打开xproj时.它给出了错误导入的项目"C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.??DotNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
我需要安装任何工具吗?
我System.Web.Helpers.WebGrid在ASP.NET Core应用程序中使用控件,呈现网格时出现以下错误
An unhandled exception occurred while processing the request.
ArgumentNullException: Value cannot be null.
Parameter name: httpContext
System.Web.HttpContextWrapper..ctor(HttpContext httpContext)
Run Code Online (Sandbox Code Playgroud)
在线
System.Web.Helpers.WebGrid objWebGrid = new System.Web.Helpers.WebGrid(Model.MeetingsObj);
Run Code Online (Sandbox Code Playgroud)
模型:
public class Meeting
{
public int MeetingId { get; set; }
public string MeetingName { get; set; }
public string Format { get; set; }
public string Location { get; set; }
}
public class MeetingVM
{
public Meeting MeetingObj { get; set; }
public List<Meeting> MeetingsObj { get; set; } …Run Code Online (Sandbox Code Playgroud) 我们将应用程序日志Azure BLOB存储在存储中。我们目前正在使用文件的完整 URI 下载文件。每次Azure BLOB更改设置时,文件名也会更改。所以我们收到错误,因为文件不存在。
建议一种从目录中使用文件扩展名获取文件的方法,而无需在 UI 中使用文件名。