Ejemplo n.º 1
0
        private void DoCreditAccountEvent(CreditAccount detail)
        {
            using (var db = new BillingwareDataContext())
            {
                var account = db.Accounts.FirstOrDefault(a => a.AccountNumber == detail.Request.AccountNumber);

                if (account == null)
                {
                    return;
                }

                account.Balance += detail.Request.Amount;

                db.Entry(account).State = EntityState.Modified;
                db.SaveChanges();
            }
        }
Ejemplo n.º 2
0
        private void DoEditAccount(EditAccount req)
        {
            var db = new BillingwareDataContext();

            var account = db.Accounts.FirstOrDefault(a => a.AccountNumber == req.AccountNumber);

            if (account == null)
            {
                Sender.Tell(new AccountEdited(new CommonStatusResponse(message: "Not found", code: "404", subCode: "404.1")), Self);
                return;
            }

            account.Alias = req.Alias;
            account.Extra = req.Extra;

            db.Entry(account).State = EntityState.Modified;
            db.SaveChanges();

            Sender.Tell(new AccountEdited(new CommonStatusResponse(message: "Successful")), Self);
        }