예제 #1
0
 public bool Update(FraudTransactions.Models.Transaction item)
 {
     FraudTransactions.DataModel.Transaction transactionDb = new FraudTransactions.DataModel.Transaction();
     transactionDb.Id              = item.Id;
     transactionDb.step            = item.step;
     transactionDb.type            = item.type;
     transactionDb.amount          = item.amount;
     transactionDb.nameOrig        = item.nameOrig;
     transactionDb.oldBalanceOrig  = item.oldBalanceOrig;
     transactionDb.newBalanceOrig  = item.newBalanceOrig;
     transactionDb.nameDest        = item.nameDest;
     transactionDb.oldBalanceDest  = item.oldBalanceDest;
     transactionDb.newBalanceDest  = item.newBalanceDest;
     transactionDb.isFraud         = item.isFraud;
     transactionDb.isFlaggedFraud  = item.isFlaggedFraud;
     db.Entry(transactionDb).State = EntityState.Modified;
     db.SaveChanges();
     return(true);
 }
예제 #2
0
 public FraudTransactions.Models.Transaction Add(FraudTransactions.Models.Transaction item)
 {
     FraudTransactions.DataModel.Transaction transactionDb = new FraudTransactions.DataModel.Transaction();
     transactionDb.Id             = item.Id;
     transactionDb.step           = item.step;
     transactionDb.type           = item.type;
     transactionDb.amount         = item.amount;
     transactionDb.nameOrig       = item.nameOrig;
     transactionDb.oldBalanceOrig = item.oldBalanceOrig;
     transactionDb.newBalanceOrig = item.newBalanceOrig;
     transactionDb.nameDest       = item.nameDest;
     transactionDb.oldBalanceDest = item.oldBalanceDest;
     transactionDb.newBalanceDest = item.newBalanceDest;
     transactionDb.isFraud        = item.isFraud;
     transactionDb.isFlaggedFraud = item.isFlaggedFraud;
     db.Transactions.Add(transactionDb);
     db.SaveChanges();
     return(item);
 }
예제 #3
0
 public FraudTransactions.Models.Transaction Get(int id)
 {
     FraudTransactions.DataModel.Transaction transactionsDbSet = db.Transactions.Find(id);
     FraudTransactions.Models.Transaction    transaction       =
         new Models.Transaction()
     {
         Id             = transactionsDbSet.Id,
         step           = transactionsDbSet.step,
         type           = transactionsDbSet.type,
         amount         = transactionsDbSet.amount,
         nameOrig       = transactionsDbSet.nameOrig,
         oldBalanceOrig = transactionsDbSet.oldBalanceOrig,
         newBalanceOrig = transactionsDbSet.newBalanceOrig,
         nameDest       = transactionsDbSet.nameDest,
         oldBalanceDest = transactionsDbSet.oldBalanceDest,
         newBalanceDest = transactionsDbSet.newBalanceDest,
         isFraud        = transactionsDbSet.isFraud,
         isFlaggedFraud = transactionsDbSet.isFlaggedFraud
     };
     return(transaction);
 }
예제 #4
0
 public void Remove(int id)
 {
     FraudTransactions.DataModel.Transaction transaction = db.Transactions.Find(id);
     db.Transactions.Remove(transaction);
     db.SaveChanges();
 }