我需要从表格中获取下周的数据(从周一到周日的日期),从今天开始计算。
以下是如何获取今天和明天的数据:
public JsonResult GetTodayList()
{
var items = db.Appointments.Where(x => x.Date == DateTime.Today)
.Select(x => new
{
title = x.Title,
time = x.Start_appointment
}).ToList();
return Json(items, JsonRequestBehavior.AllowGet);
}
public JsonResult GetTommorowList()
{
DateTime tommorow = DateTime.Today.AddDays(1);
var items = db.Appointments.Where(x => x.Date == tommorow)
.Select(x => new
{
title = x.Title,
time = x.Start_appointment
}).ToList();
return Json(items, JsonRequestBehavior.AllowGet);
}
我该如何获取下周的日期数据?
Where(x=> x.Date >= nextMonday && x.Date < followingMonday)
。 - pinkfloydx33