【发布时间】:2018-03-26 19:35:05
【问题描述】:
我有一个日期字段“Fecha”。我需要使用日期范围和此字段过滤我的表格。
这是我的控制器:
// GET: tb_visitas
public ActionResult Index(DateTime? startdate, DateTime? enddate)
{
var tb_visitas = db.tb_visitas.Include(t => t.tb_brochuras).Include(t => t.tb_despertai).Include(t => t.tb_estrangeiros).Include(t => t.tb_folhetos).Include(t => t.tb_livros).Include(t => t.tb_sentinela);
return View(tb_visitas.ToList());
}
这是我的模型public partial class tb_visitas:
public int id_visita { get; set; }
[Required]
public int id { get; set; }
[Required]
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime Fecha { get; set; }
public Nullable<int> id_g { get; set; }
public string videos { get; set; }
public Nullable<int> id_fol { get; set; }
public Nullable<int> id_livros { get; set; }
public Nullable<int> id_broc { get; set; }
public Nullable<int> id_wp { get; set; }
public string Relatorio { get; set; }
public virtual tb_brochuras tb_brochuras { get; set; }
public virtual tb_despertai tb_despertai { get; set; }
public virtual tb_estrangeiros tb_estrangeiros { get; set; }
public virtual tb_folhetos tb_folhetos { get; set; }
public virtual tb_livros tb_livros { get; set; }
public virtual tb_sentinela tb_sentinela { get; set; }
【问题讨论】:
-
对不起!如何按日期范围过滤我的表格?示例:过滤 01/03/2018 和 09/03/2018 之间的记录。
-
为什么不能对集合进行 Where 操作?
标签: c# asp.net asp.net-mvc visual-studio