Esempio n. 1
0
        public static void MarkDepositFinished(List <int> ids)
        {
            try
            {
                using (DepositContext db = new DepositContext())
                {
                    var deposits = db.Deposits?.Where(p => ids.Contains(p.Id)).ToList();
                    foreach (var deposit in deposits)
                    {
                        deposit.Status = StatusDeposit.Finished;
                    }

                    db.SaveChanges();
                }
            }
            catch (Exception e)
            { }
        }
Esempio n. 2
0
        public static List <Deposit> GetActiveDepost()
        {
            List <Deposit> deposits = new List <Deposit>();

            try
            {
                using (DepositContext db = new DepositContext())
                {
                    deposits = db.Deposits?.Where(p => p.Status == StatusDeposit.Active).ToList();
                }
            }
            catch (Exception e)
            {
                deposits = new List <Deposit>();
            }

            return(deposits);
        }
Esempio n. 3
0
        public static List <Deposit> GetDepostByUserId(int userId)
        {
            List <Deposit> deposits = new List <Deposit>();

            try
            {
                using (DepositContext db = new DepositContext())
                {
                    deposits = db.Deposits?.Where(p => p.UserId == userId).ToList();
                }
            }
            catch (Exception e)
            {
                deposits = new List <Deposit>();
            }

            return(deposits);
        }
Esempio n. 4
0
        public static bool AddNewDeposit(Deposit deposit)
        {
            var success = false;

            try
            {
                using (DepositContext db = new DepositContext())
                {
                    db.Deposits.Add(deposit);
                    db.SaveChanges();
                    success = true;
                }
            }
            catch (Exception e)
            {
                success = false;
            }

            return(success);
        }
 public DepositRepository(DepositContext depositContext)
 {
     _depositContext = depositContext;
 }