Пример #1
0
        public IActionResult CreateAccountTransaction()
        {
            CodesRepository codeRepository = new CodesRepository(context);

            ViewBag.Accounts          = new AccountsRepository(context).GetAccounts(userManager.GetUserId(User));
            ViewBag.TransactionTypes  = codeRepository.GetCodesByCodeGroupGuid(CodeGroups.TransactionType);
            ViewBag.TransactionStates = codeRepository.GetCodesByCodeGroupGuid(CodeGroups.TransactionState);

            return(View());
        }
Пример #2
0
        public IActionResult EditCheckTransaction(Guid transactionGuid)
        {
            if (transactionGuid == null)
            {
                return(BadRequest());
            }

            var checkTransaction = context.CheckTransaction
                                   .Where(x => x.TransactionGuid == transactionGuid)
                                   .SingleOrDefault();

            if (checkTransaction == null)
            {
                return(NotFound());
            }

            var transaction = context.Transaction
                              .Where(x => x.TransactionGuid == transactionGuid)
                              .SingleOrDefault();

            EditCheckTransactionViewModel model = new EditCheckTransactionViewModel()
            {
                TransactionGuid = transaction.TransactionGuid,
                AccountGuid     = transaction.AccountGuid,
                TypeGuid        = transaction.TypeCodeGuid,
                StateGuid       = transaction.StateCodeGuid,
                Title           = transaction.Title,
                Cost            = transaction.Cost.ToString(),
                AccountSide     = transaction.AccountSide,
                Serial          = checkTransaction.Serial,
                Description     = transaction.Description,
                IssueDate       = checkTransaction.IssueDate.ToString(),
                ReceiptDate     = transaction.ReceiptDate.ToString()
            };

            CodesRepository codeRepository = new CodesRepository(context);

            ViewBag.Accounts          = new AccountsRepository(context).GetAccounts(userManager.GetUserId(User));
            ViewBag.TransactionTypes  = codeRepository.GetCodesByCodeGroupGuid(CodeGroups.TransactionType);
            ViewBag.TransactionStates = codeRepository.GetCodesByCodeGroupGuid(CodeGroups.TransactionState);

            return(View(model));
        }