c# - 获取整个列表中的第一行重复值视图中的计数列表
问题描述
在 MS 服务器 Sql 中触发时的相同查询是正确的值。行数相同,但只有第一行在 LINQ 中重复......没有错误,不知道!
Table("SalarySlip")]
public class Document
{
[Key]
public string EmployeeID { get; set; }
public string Basic { get; set; }
public string Bonus { get; set; }
public string Flexi { get; set; }
public string HRA { get; set; }
public string Month { get; set; }
public string NetPay { get; set; }
public string OtherDeduction { get; set; }
public string PF { get; set; }
public string Special { get; set; }
public string TDS { get; set; }
public string TotalDeduction { get; set; }
public string TotalEarning { get; set; }
public string Year { get; set; }
}
public ActionResult EmpSalaryHistory(string EmployeeID )
{
DatabaseContext _context = new DatabaseContext();
var Userdata = _context.SalarySlip.Where(x => x.EmployeeID == EmployeeID).OrderByDescending(x => x.Month).ToList();
if (Userdata.Count != 0)
{
TempData["data"] = EmployeeID;
return View(Userdata);
}
else
{
TempData["data"] = EmployeeID;
//return View();
return RedirectToAction("Demo");
}
}
解决方案
推荐阅读
- mysql - 如何修复 Laravel AJAX 请求不起作用
- javascript - 在 Alfresco Share 中的 bundle service *.post.js 文件中,companyhome 未定义错误
- r - 计算一段时间后的累积和
- javascript - 如何配置 Vue-CLI 3 以生成没有 JavaScript 的页面?
- python - 具有多个条件和检索值的 Pandas df.loc 索引
- sql - 是否可以基于另一个表生成列?
- python - 为什么 Python 在列表理解中不排除错误
- php - 尝试在 null 上读取属性“total_product_quantity”
- mongodb - Mongo DB 存档无法从 ec2 与 vpc 对等互连
- django - 无法解析相关模型。姜戈,左塞尔