这么多年都是玩耍WPF、GIS、Avalonia、Xamarin一直都是在CS端玩耍;由于项目原因需要玩一下ASP.NET Core Web应用;今天就来分享一下最近玩耍的效果和一点小的收获吧:
@foreach (var item in @Model.ProjectInfo)
{
<div class="row" style="margin-top: 20px;margin-left:42px;">
<div class="col-xs-12">
<input type="checkbox" id="@item.ProjectId" name="@item.Name" checked="@item.Attention" />
<label for="@item.ProjectId">@item.ProjectId</label>
</div>
</div>
}
$.ajax({
url: "/SubMessageService/PostFollowerSubMessage",
type: "POST",
contentType: "application/json",
data: postData,
dataType: "json",
success: function(response) {
console.log(response)
},
error: function(jqXHR, textStatus, errorThrown) {
console.log('失败')
}
});
3、后台请求实现([FromBody]别忘了带上):
[ ]
public async Task
PostFollowerSubMessage([FromBody] SubMessageDataModel model) {
string json = ;
if(model != )
{
//王哥订阅接口
string url = "http://www.xxx.com:8090/toSave";
RestFulHelper helper = new RestFulHelper();
json = await helper.PostAsync(url, model);
};
return Content(json);
}
<style>
body {
-webkit-user-select: none; /* Safari */
-moz-user-select: none; /* Firefox */
-ms-user-select: none; /* IE10+/Edge */
user-select: none; /* Standard */
}
</style>
<script>
document.addEventListener('contextmenu', function (e) {
e.preventDefault();
});
</script>