【发布时间】:2016-06-28 08:26:45
【问题描述】:
您好,我正在尝试向用户添加评论
我的 Bll 中有以下代码
public void AddReview(Guid locationId, ReviewDto review, UserDto user)
{
var location = _locationRepository.Get(locationId);
var reviewModel = new Review
{
Comment = review.Comment,
Rate = review.Rate,
Location = location,
LocationId = location.Id,
User = new User
{
Name = user.Name,
Email = user.Email,
Password = user.Password
},
UserId = user.Id
};
_reviewRepository.Add(reviewModel);
_reviewRepository.Save();
location.AddReview(reviewModel);
}
}
可以从 Post 发送 User 和 Review 吗?
U.R.I.应该看起来像..我想 /api/location/{id}/review/user (POST)....我不知道,我会很感激一些帮助..谢谢!!
【问题讨论】:
标签: c# .net rest asp.net-web-api http-post