如何用EF检查两个特定日期之间的数据库?

时间:2016-12-13 05:45:53

标签: c# asp.net-mvc entity-framework

我想为用户提供两个特定日期(开始)的订单报告。我想计算在该期间内订购的金额产品(包括价格)。

这是关于我的想法:

 public ActionResult GetReport(DateTime startTime, DateTime endTime)
        {    
            var getReport = db.Orders.Where(/*Date that matches between start and end time*/);

            //calculate the amount of each products(incl price) 

            return View(reportViewModel);       
        }

顺序表:

    public System.Guid Id { get; set; }
    public System.Guid UserId { get; set; }     
    public System.DateTime Ordered { get; set; }

    public virtual User User { get; set; }
    public virtual ICollection<Product> Products { get; set; }

另外,如何从View到Controller(MVC)发送选定的日期值?

0 个答案:

没有答案