如何在Linq中使用逻辑“和”运算符

时间:2019-05-10 17:16:25

标签: c# linq asp.net-core

谁能告诉我为什么这行不通?它返回一个空列表。 我的http请求看起来像这样:<form action="rruga1.php" method="post"> Current Tokens:<div class="current-amount" id="amount-1" style=" overflow: hidden; position:relative;"></div> <br> Enter Your Amount: <br> <input type="text" placeholder="Enter Amount" class="paid-amount" name="token" > <button class="btn-pay" ><i class="ion-ios-plus-outline"></i>Pay</button> </form> <script> var token = 0; document.querySelector('.btn-pay').addEventListener('click', function(){ var input = document.querySelector('.paid-amount').value; if (input < 0){ alert("Invalid Value"); } else{ calcToken = (input / 100); } token = token + calcToken; document.getElementById('amount-1').textContent = token; }); </script> 而且我在数据库中有一部电影,评分为= 8。

https://localhost:44313/api/movies/7/9

2 个答案:

答案 0 :(得分:1)

绑定是问题

假设您的控制器名为MoviesController,可以尝试

 [HttpGet("{start}/{end}")]
 public IEnumerable<Movie> GetReport([FromUri]int start, [FromUri]int end)
 {
     return _context.Movies
         .Where(m => (m.Rating >= start) && (m.Rating <= end))
         .OrderBy(x => x.YearRelease)
         .ToList();
 } 

答案 1 :(得分:0)

调试它。我猜想函数参数变量没有正确填充,因此它正在寻找0 <= rating <= 0。标签可能区分大小写吗?

相关问题