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); }
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); }