public List <Order> GetDoneOrders() { using (SSAspNetContext context = new SSAspNetContext()) { return(context.Orders.Where(p => p.StateOrder == (StateOrder)1).OrderBy(p => p.OrderId).ToList()); } }
public void AddNewOrder() { using (SSAspNetContext ordersContext = new SSAspNetContext()) { ordersContext.Orders.Add(this); ordersContext.SaveChanges(); } }
public int GetLastOrderId() { lock (locker) { using (SSAspNetContext ordersContext = new SSAspNetContext()) { int id = ordersContext.Orders.Count(); return(id); } } }
public Order(int?id) { using (SSAspNetContext ordersContext = new SSAspNetContext()) { var or = ordersContext.Orders.Find(id); if (or != null) { OrderId = or.OrderId; _dateTimeOrder = or.DateTimeOrder; _modelCar = or.ModelCar; _numberCar = or.NumberCar; _stateOrder = or.StateOrder; _costOrder = or.CostOrder; _orderPaid = or.OrderPaid; _conditionCar = or.ConditionCar; } } }
public Price(int id) { using (SSAspNetContext priceContext = new SSAspNetContext()) { Price price = priceContext.Prices.Find(id); if (price != null) { CarBody = price.CarBody; CarWheels = price.CarWheels; CarEngine = price.CarEngine; CarBrakes = price.CarBrakes; CarUndercarriage = price.CarUndercarriage; BusSalon = price.BusSalon; BusHandsrails = price.BusHandsrails; BusUpholstery = price.BusUpholstery; PasCarwheelBalancing = price.PasCarwheelBalancing; TruckHydraulics = price.TruckHydraulics; } } }
public void EditPrice() { using (SSAspNetContext priceContext = new SSAspNetContext()) { Price price = priceContext.Prices.Find(1); if (price != null) { price.CarBody = CarBody; price.CarWheels = CarWheels; price.CarEngine = CarEngine; price.CarBrakes = CarBrakes; price.CarUndercarriage = CarUndercarriage; price.BusSalon = BusSalon; price.BusHandsrails = BusHandsrails; price.BusUpholstery = BusUpholstery; price.PasCarwheelBalancing = PasCarwheelBalancing; price.TruckHydraulics = TruckHydraulics; priceContext.SaveChanges(); } } }
public void EditOrder() { lock (locker) { int?id = OrderId; using (SSAspNetContext ordersContext = new SSAspNetContext()) { Order newOrder = ordersContext.Orders.Find(id); newOrder.OrderId = OrderId; newOrder.DateTimeOrder = DateTimeOrder; newOrder.ModelCar = ModelCar; newOrder.NumberCar = NumberCar; newOrder.StateOrder = StateOrder; newOrder.CostOrder = CostOrder; newOrder.OrderPaid = OrderPaid; newOrder.ConditionCar = ConditionCar; ordersContext.SaveChanges(); } } }