/// <summary> /// 立刻购买该车 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult BuyCar(int id) { OrderBll bll=new OrderBll(); OrderModel order=new OrderModel(); //bll.AddOrder(); return null; }
public int EditOrder(int id, int buyManID, int carID, decimal price, int saleManID) { OrderModel order = new OrderModel(); order.ID = id; order.BuyManID = buyManID; order.CarID = carID; order.Price = price; order.SaleManID = saleManID; order.Date = DateTime.Now; return bll.EditOrder(order); }
public int AddOrder(int buyManID, int carID, decimal price, int saleManID) { OrderModel order=new OrderModel(); order.BuyManID = buyManID; order.CarID = carID; order.Price = price; order.SaleManID = saleManID; order.Date = DateTime.Now; bll.AddOrder(order); return 1; }
/// <summary> /// 根据Order的ID获取一个Order /// </summary> /// <returns></returns> public OrderModel GetOrderById(int id) { CarSaleEntities context=new CarSaleEntities(); var order = context.Order.FirstOrDefault(o=>o.ID==id); OrderModel model=new OrderModel(); model.ID = order.ID; model.BuyManID = order.BuyManID; model.CarID = order.CarID; model.Date = order.Date; model.Price = order.Price; model.SaleManID = order.SaleManID; return model; }
public List<OrderModel> GetOrdersByUserId(int userid) { CarSaleEntities context=new CarSaleEntities(); var orders=context.Order.Where(o => o.BuyManID == userid); List<OrderModel> list=new List<OrderModel>(); foreach (var order in orders) { OrderModel model = new OrderModel(); model.ID = order.ID; model.BuyManID = order.BuyManID; model.CarID = order.CarID; model.Date = order.Date; model.Price = order.Price; model.SaleManID = order.SaleManID; list.Add(model); } return list; }
public int EditOrder(OrderModel order) { try { var id = order.ID; var editOrder = context.Order.FirstOrDefault(o => o.ID == id); editOrder.BuyManID = order.BuyManID; editOrder.CarID = order.CarID; editOrder.Date = order.Date; editOrder.Price = order.Price; editOrder.SaleManID = order.SaleManID; context.SaveChanges(); return 1; } catch (Exception) { return 0; } }
public int AddOrder(OrderModel order) { try { Order newOrder = new Order(); newOrder.BuyManID = order.BuyManID; newOrder.CarID = order.CarID; newOrder.Date = order.Date; newOrder.Price = order.Price; newOrder.SaleManID = order.SaleManID; context.AddToOrder(newOrder); context.SaveChanges(); return 1; } catch (Exception) { return 0; } }
public ActionResult AddToOrder(int carid) { var session = Session["logID"]; int userid = Int32.Parse(session.ToString()); OrderBll orderBll=new OrderBll(); CarBll carBll=new CarBll(); var car=carBll.GetCarById(carid); OrderModel newOrder=new OrderModel(); newOrder.BuyManID = userid; newOrder.CarID = carid; newOrder.Price = car.Price; newOrder.Date = DateTime.Now; newOrder.SaleManID = car.UserInfo_ID; int result=orderBll.AddOrder(newOrder); if (result==1) { return RedirectToAction("MyOrder", "Home"); } else { return RedirectToAction("Failed", "PageHelper"); } }
public List<OrderModel> GetAllOrders() { try { List<OrderModel> list=new List<OrderModel>(); var orders = context.Order; foreach (var order in orders) { OrderModel model=new OrderModel(); model.ID = order.ID; model.BuyManID = order.SaleManID; model.CarID = order.CarID; model.Date = order.Date; model.Price = order.Price; model.SaleManID = order.SaleManID; list.Add(model); } return list; } catch (Exception) { return null; } }
/// <summary> /// 出售者的待处理订单 /// </summary> /// <returns></returns> public ActionResult MyOrders() { var session = Session["logID"]; if (session == null) { return RedirectToAction("Login", "Home"); } else { int userid = Int32.Parse(session.ToString()); CarSaleEntities context = new CarSaleEntities(); List<OrderModel> list=new List<OrderModel>(); var orders=context.Order.Where(o => o.SaleManID == userid); if (orders.Count()==0) { return RedirectToAction("NoOrder"); } else { foreach (var order in orders) { OrderModel model = new OrderModel(); model.ID = order.ID; model.BuyManID = order.BuyManID; model.CarID = order.CarID; model.Date = order.Date; model.Price = order.Price; model.SaleManID = order.SaleManID; list.Add(model); } return View(list); } } }
public Job(OrderModel order, string hrid) : this() { this.Name = order.Name; if (order == null) throw new ArgumentNullException("order is provided null"); this.Order = order; if (string.IsNullOrEmpty(hrid)) throw new ArgumentException("hrid is provided null"); this.HRID = hrid; }
public int EditOrder(OrderModel order) { return dal.EditOrder(order); }
public int AddOrder(OrderModel order) { return dal.AddOrder(order); }