【发布时间】:2018-07-28 03:44:41
【问题描述】:
我想显示整个月的输出和所有价格,但我想按组月 和每个月的总价格例如:看看照片中的输出
[HttpGet("api/recent-reports")]
public JsonResult GetStatusSummaryRecentReports()
{
try
{
IEnumerable<Booking> list = _bookingDataService
.Query(d => d.BookingDate.Month < (DateTime.Now.Month));
IEnumerable<int> data_month = list.Select(d => d.BookingDate.Month)
.Distinct().Take(4);
StatusSummaryRecentReports obj = new StatusSummaryRecentReports();
//obj.Total_Order_ByMonth = Total_PriceOreder_Each_Month;
//obj.Months = Months;
return Json(obj);
}
catch (Exception ex)
{
Response.StatusCode = (int)HttpStatusCode.BadRequest;
return Json(new { message = ex.Message });
}
}
【问题讨论】:
-
什么是_bookingDataService?
-
私有 IDataService
_bookingDataService; -
公共接口 IDataService
{ IEnumerable GetAll();无效创建(T实体); T GetSingle(Expression > 谓词); IEnumerable 查询(表达式 > 谓词);无效更新(T实体);无效删除(T实体); } -
如果你有不同年份的同一个月怎么办?
-
同月必须同年,
标签: c# asp.net-mvc linq