public async Task <IActionResult> Edit(int id, [Bind("Id,Account_Id,TimeStamp,Type,Description,Amount,Balance_After")] Financial_Transaction financial_Transaction)
        {
            if (id != financial_Transaction.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(financial_Transaction);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!Financial_TransactionExists(financial_Transaction.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(financial_Transaction));
        }
        public async Task <IActionResult> Create([Bind("Id,Account_Id,TimeStamp,Type,Description,Amount,Balance_After")] Financial_Transaction financial_Transaction)
        {
            if (ModelState.IsValid)
            {
                _context.Add(financial_Transaction);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(financial_Transaction));
        }
Esempio n. 3
0
        public void Financial_Transaction_TimeStamp_Test()
        {
            //arrange
            Financial_Transaction transaction = new Financial_Transaction();

            //act
            transaction.TimeStamp = new DateTime(2020, 5, 5, 1, 1, 1);
            var testdate = transaction.TimeStamp;

            //assert
            Assert.Equal(testdate.ToString(), transaction.TimeStamp.ToString());
        }