Ejemplo n.º 1
0
 public static List <Account> GetAllBlockedAccounts()
 {
     using (var context = new ATMDbContext())
     {
         return(context.Accounts.Include(a => a.Client).Where(r => r.IsActive == false).ToList());
     }
 }
Ejemplo n.º 2
0
 public static List <Manager> GetAllManagers()
 {
     using (var context = new ATMDbContext())
     {
         return(context.Managers.Include(u => u.ATMManagerActions).ToList());
     }
 }
Ejemplo n.º 3
0
 //
 public static bool AccountExist(string accountNum)
 {
     using (var context = new ATMDbContext())
     {
         return(context.Accounts.Any(u => u.CardNumber == accountNum));
     }
 }
Ejemplo n.º 4
0
 //
 public static List <RegularPayment> GetRegularPayments(string accountNum)
 {
     using (var context = new ATMDbContext())
     {
         return(context.RegularPayments.Include(p => p.CurrentAccount).Where(r => r.CardNumber == accountNum).ToList());
     }
 }
Ejemplo n.º 5
0
 //
 public static void AddManager(Manager manager)
 {
     using (var context = new ATMDbContext())
     {
         context.Managers.Add(manager);
         context.SaveChanges();
     }
 }
Ejemplo n.º 6
0
 //
 public static void AddATM(ATM atm)
 {
     using (var context = new ATMDbContext())
     {
         context.ATMs.Add(atm);
         context.SaveChanges();
     }
 }
Ejemplo n.º 7
0
 public static List <Client> GetAllClients()
 {
     using (var context = new ATMDbContext())
     {
         return(context.Clients
                .Include(u => u.Accounts).ToList());
     }
 }
Ejemplo n.º 8
0
 //
 public static void SaveAccount(Account account)
 {
     using (var context = new ATMDbContext())
     {
         context.Entry(account).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Ejemplo n.º 9
0
 //
 public static void SaveATM(ATM atm)
 {
     using (var context = new ATMDbContext())
     {
         context.Entry(atm).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Ejemplo n.º 10
0
 //
 public static Manager GetManagerById(string managerId)
 {
     using (var context = new ATMDbContext())
     {
         return(context.Managers
                .Include(u => u.ATMManagerActions)
                .FirstOrDefault(u => u.ManagerId == managerId));
     }
 }
Ejemplo n.º 11
0
 //
 public static ATM GetATMByCode(string atmCode)
 {
     using (var context = new ATMDbContext())
     {
         return(context.ATMs.Include(u => u.ATMAccountAction)
                .Include(u => u.AtmManagerActions)
                .FirstOrDefault(u => u.ATMCode == atmCode));
     }
 }
Ejemplo n.º 12
0
 //
 public static void AddRegularPayment(RegularPayment regularPayment)
 {
     using (var context = new ATMDbContext())
     {
         regularPayment.DeleteDatabaseValues();
         context.RegularPayments.Add(regularPayment);
         context.SaveChanges();
     }
 }
Ejemplo n.º 13
0
 public static void AddATMManagerAction(ATMManagerAction atmManagerAction)
 {
     using (var context = new ATMDbContext())
     {
         atmManagerAction.DeleteDatabaseValues();
         context.ATMManagerActions.Add(atmManagerAction);
         context.SaveChanges();
     }
 }
Ejemplo n.º 14
0
 public static List <ATM> GetAllATMs()
 {
     using (var context = new ATMDbContext())
     {
         return(context.ATMs.
                Include(u => u.AtmManagerActions)
                .Include(u => u.ATMAccountAction).ToList());
     }
 }
Ejemplo n.º 15
0
 //
 public static Client GetClientByItn(string clientItn)
 {
     using (var context = new ATMDbContext())
     {
         return(context.Clients
                .Include(u => u.Accounts)
                .FirstOrDefault(u => u.ITN == clientItn));
     }
 }
Ejemplo n.º 16
0
 //
 public static void AddATMAccountAction(ATMAccountAction action)
 {
     using (var context = new ATMDbContext())
     {
         action.DeleteDatabaseValues();
         context.ATMAccountActions.Add(action);
         context.SaveChanges();
     }
 }
Ejemplo n.º 17
0
 //
 public static Account GetAccountByNum(string accountNum)
 {
     using (var context = new ATMDbContext())
     {
         return(context.Accounts
                .Include(u => u.ATMAccountAction)
                .Include(u => u.Client)
                .Include(u => u.Client.Accounts)
                .FirstOrDefault(u => u.CardNumber == accountNum));
     }
 }
Ejemplo n.º 18
0
 //
 public static void AddClient(Client client)
 {
     using (var context = new ATMDbContext())
     {
         context.Clients.Add(client);
         foreach (var clientAccount in client.Accounts.ToArray())
         {
             context.Accounts.Add(clientAccount);
         }
         context.SaveChanges();
     }
 }