Пример #1
0
        public static bool MarkOrderTopBalanceFinished(string orderId)
        {
            bool success = false;

            try
            {
                using (var db = new OrderTopBalanceContext())
                {
                    var order = db.Orders.FirstOrDefault(p => p.OrderId == orderId);

                    if (order != null)
                    {
                        order.Status      = StatusOrder.Finished;
                        order.DatePayment = DateTime.Now;
                        db.SaveChanges();
                        AddMoneyByUserId(order.UserId, order.Amount);
                        success = true;
                    }
                }
            }
            catch (Exception e)
            {
                success = false;
            }

            return(success);
        }
Пример #2
0
        public static bool AddNewOrderTopBalance(OrderTopBalanceModel order)
        {
            var success = false;

            try
            {
                using (var db = new OrderTopBalanceContext())
                {
                    db.Orders.Add(order);
                    db.SaveChanges();
                    success = true;
                }
            }
            catch (Exception e)
            {
                success = false;
            }

            return(success);
        }