Roy*_*ino 5 c# rest asp.net-web-api angularjs
我是c#的新手,我完全不知道我接下来应该做什么来处理来自我用Bootstrap和Html创建的输入表单中的用户的输入以及角度js控制器.
每当我尝试使用我的api的Get方法返回值时,我的整个控制器都会中断.
我已经阅读了很多关于RESTful api web方法的教程和知识,我开始过多地混淆自己并且过度思考它,因为我理解这是一个简单的过程.
以下是我的控制器的代码.
public class FeedbackController : ApiController
{
// GET: api/Feedback
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET: api/Feedback/
public string (Feedback id);
{
}
// POST: api/Feedback
public void Post([FromBody]Feedback value)
{
}
// PUT: api/Feedback
public void Put( [FromBody]Feedback value)
{
var test = value.FeedbackRating;
}
// DELETE: api/Feedback/
public void Delete(Feedback id)
{
}
public string post([FromUri]Feedback value)
{
return "Put returning: " + value;
}
Run Code Online (Sandbox Code Playgroud)
// angular js commonModule.controller('feedbackController',['$ scope','$ modal','$ timeout','authenticationService',function($ scope,$ modal,$ timeout,authenticationService){
var init = function () {
$scope.feedbackPopup();
}
$scope.feedbackPopup = function () {
var modalInstance = $modal.open({
templateUrl: '/Scripts/app/common/views/popup.tpl.html',
resolve: {
},
controller: function ($scope, $modalInstance) {
$scope.close = function () {
$modalInstance.close();
};
$scope.submitFeedback = function () {
$scope.feedback = {
FeedbackRating: 1,
FeedbackSubject: 1,
FeedbackUpload: 1,
FeedbackDescription:1
};
authenticationService.submitFeedback($scope.feedback).then(
// Success Handler
function (result) {
$modalInstance.close();
$scope.message = "Feedback submitted";
$timeout(function () {
$scope.message = "";
}, 3000);
},
// Failure Handler
function () {
$scope.message = "Error updating specialization";
});
}
}
});
}
init();
}]);
})();
Run Code Online (Sandbox Code Playgroud)
反馈课程
{
public class Feedback
{
public int FeedbackRating { get; set; }
private string EncryptedHexPuid { get; set; }
public string FeedbackDescription { get; set; }
public string FeedbackSubject { get; set; }
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1299 次 |
| 最近记录: |