public List <DTO_Transaction> GetTransactions(DTO_User user) { List <DTO_Transaction> transactions = new List <DTO_Transaction>(); using (DB_111206_scrapEntities db = new DB_111206_scrapEntities()) { var match = db.Users.Where(u => u.email == user.Email && u.pwd == user.Password).FirstOrDefault(); if (match != null) { var all_trans = match.Transactions.ToList(); { foreach (var t in all_trans) { DTO_Transaction tran = new DTO_Transaction(); tran.Id = t.tranId; tran.Price = (double)t.salePrice; tran.DT = t.tranDate; transactions.Add(tran); } } } } return(transactions); }
public API_Response <long> Add([FromBody] DTO_Transaction model, [FromUri] string api_key = null) { return(InvokeAPI(() => { var VM = model.ViewModel; if (!Global.Cache.CheckUserExists(VM.TransactionSender.UserID, VM.TransactionReceiver.UserID)) { throw new UserNotFoundException(VM.TransactionSender.UserID, VM.TransactionReceiver.UserID); } // var transactionId = _DL.Transactions.Add.Transaction(VM); // var transaction = _DL.Transactions.Get.ByID(transactionId); // if (transaction != null) { EventCreator.NewTransactionReceivedConfirmationRequired(transaction.TransactionSender.UserID, transaction.TransactionReceiver.UserID, transactionId); } return transactionId; }, api_key)); }