/// <summary>
/// 获取资金流
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult GetUserCashFlows(int? pageIndex, int? pageSize, int month, string search)
{
var result = new ResultDto();
var userId = (string)ViewBag.UserId;
try
{
Specification<UserCashFlow> specification = new TrueSpecification<UserCashFlow>();
specification &= new DirectSpecification<UserCashFlow>(m => m.UserId == userId && m.Month == month && !m.Deleted);
if (!string.IsNullOrEmpty(search))
{
specification &= new DirectSpecification<UserCashFlow>(m => m.Desc.Contains(search));
}
var model = _dbContext.UserCashFlows.Where(specification.SatisfiedBy())
.Select(m => new
{
m.Desc,
m.Cost,
m.TotalMoney,
m.OperateDate
});
var list = model.OrderByDescending(m => m.OperateDate)
.Skip(((int)pageIndex - 1) * (int)pageSize)
.Take((int)pageSize)
.ToList();
result.Success = true;
result.Message = "获取资金流!";
result.Data = new
{
total = model.Count(),
rows = list,
};
}
catch (Exception e)
{
result.Message = "获取失败!";
result.ExMessage = e.Message;
}
return Json(result, JsonRequestBehavior.AllowGet);
}
相关文章
- 10-12用事实说话,成熟的ORM性能不是瓶颈,灵活性不是问题:EF5.0、PDF.NET5.0、Dapper原理分析与测试手记
- 10-12.net性能最高的EF分页写法
- 10-12性能测试类,让你写法代码养成经常测试的好习惯 -ASP.NET C#
- 10-12ASP.NET MVC+EF在服务端分页使用jqGrid以及jquery Datatables的注意事项
- 10-12SQL Server分页的存储过程写法以及性能比较
- 10-12用事实说话,成熟的ORM性能不是瓶颈,灵活性不是问题:EF5.0、PDF.NET5.0、Dapper原理分析与测试手记
- 10-12构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(8)-MVC与EasyUI DataGrid 分页
- 10-12构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(8)-MVC与EasyUI DataGrid 分页
- 10-12EF架构~linq模拟left join的两种写法,性能差之千里!
- 10-12构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(8)-MVC与EasyUI DataGrid 分页