Пример #1
0
        public async Task <ActionResult <AppTransactions> > Transaction(TransactionsDto transactionsDto)
        {
            var transactions = new AppTransactions {
                CardId      = transactionsDto.Id,
                StationFrom = transactionsDto.StationFrom,
                Date_In     = transactionsDto.Date_In
            };

            _context.Transactions.Add(transactions);
            await _context.SaveChangesAsync();

            return(transactions);
        }
Пример #2
0
        public async Task <ActionResult <AppTransactions> > UpdateTrasaction(TransactionsDto transactionsDto)
        {
            var no_transactions = await _context.Transactions.FirstOrDefaultAsync(nt => nt.CardId == transactionsDto.CardId && nt.Date_In == transactionsDto.Date_In);

            var transactions = new AppTransactions {
                Id        = transactionsDto.Id,
                CardId    = transactionsDto.CardId,
                StationTo = transactionsDto.StationTo,
                Date_Out  = transactionsDto.Date_Out
            };


            _context.Transactions.Update(transactions);
            await _context.SaveChangesAsync();

            return(transactions);
        }