public async Task <IActionResult> PostRegister([FromBody] ETransaction transaction) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var guardo = await _transactionService.Save(transaction); if (guardo) { return(Ok(new EResponse())); } else { return(Ok(new EResponse() { Code = "1", Desc = "Transaction fail" })); } } catch (Exception ex) { return(Ok(new EResponse() { Code = "2", Desc = ex.GetDetail() })); } }
public TransactionEdge(IBusinessObject from, IBusinessObject to, string edgeClassName, ETransaction transaction) { From = from; To = to; EdgeClassName = edgeClassName; Transaction = transaction; }
public async Task <bool> Save(ETransaction transaction) { try { var _transaction = new Transaction { Amount = transaction.Amount, NameDest = transaction.NameDest, NameOrig = transaction.NameOrig, Type = transaction.Type.ToString(), TransactionDate = DateTime.Now }; await _context.Transaction.AddAsync(_transaction); return(await _context.SaveChangesAsync() > 0); } catch (Exception) { throw; } }
//constructor public Transaction(decimal _amount, DateTime _date, ETransaction _transactionType) { amount = _amount; date = _date; transactionType = _transactionType; }
public async Task <IActionResult> Create(ETransaction transaction) { var ok = await _transactionService.Save(transaction); return(RedirectToAction("Index")); }
public TransactionItem(ETransaction transaction, IBusinessObject businessObject) { BusinessObject = businessObject; Transaction = transaction; }