I know it's a basic one, but can anyone answer it? I'd really appreciate that.
I have one table called orders where I have to get the records of orders on the weekly basis, based on the order status which is 1|2|3|4|5 but the problem is same user can placed multiple orders with the same order value so I need the user Count with the OrderDate Constraint so that I can get the weekly user Count of order with their status.
I tried using a SQL command. The status of enum values which is considered to be as 1|2|3|4|5
NOTE: I can use Group BY of orderDate, I think that will give me a exact count of Users, but not sure how. db.Orders.GetAll().Where(q => (q.Status == OrderStatus.Complete || q.Status == OrderStatus.Processing || q.Status == OrderStatus.PartiallyShipped || q.Status == OrderStatus.Cancelled || q.Status == OrderStatus.Fraudulent || q.Status == OrderStatus.SuspectedFraud) && (startDate == null || DbFunctions.TruncateTime(q.OrderDate) >= DbFunctions.TruncateTime(startDate)) && (endDate == null || DbFunctions.TruncateTime(q.OrderDate) <= DbFunctions.TruncateTime(endDate)) ).Distinct().Count();