public List<Order> GetDashboardOrdersByUserID(long AppUserID) { IOrder order = new Order(); List<Order> Orders = order.GetByUserID(AppUserID); //retrieve only last 5 days orders for dashboard return Orders.Where(x => x.DateCreated >= DateTime.Now.AddDays(-5)).ToList<Order>(); }
//Create public Order Insert(Order order) { using (Entities ctx = new Entities()) { ctx.Order.Add(order); ctx.SaveChanges(); return order; } }
public Order Insert(Order orderData) { IOrder order = new Order(); //set no user capture fields orderData.DateCreated = DateTime.Now; orderData = order.Insert(orderData); return orderData; }
public JsonResult CreateNewOrder(Order order) { try { Order result = new OrderService().Insert(order); var orderResult = new { Result = true, OrderID = result.OrderID.ToString() }; return Json(orderResult); } catch (Exception exception) { var orderResult = new { Result = false, OrderID = 0, ErrorMessage = FormatMessages.ErrorMessage("Error creating order.") }; return Json(orderResult); } }
public Order getById(long OrderID) { IOrder order = new Order(); return order.GetByID(OrderID); }