Ejemplo n.º 1
0
        public IHttpActionResult PostTransaction(TransactionDTO transaction)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            transactionService.Create(transaction, UserRecord);
            return(Json(transaction));
        }
Ejemplo n.º 2
0
        public IActionResult Create([FromBody] TransactionDBModel transaction)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            bool createResult = _transactionBL.Create(transaction);

            if (!createResult)
            {
                return(BadRequest());
            }

            return(Ok(new EmptyResult()));
        }
Ejemplo n.º 3
0
        public IActionResult Create([Bind("Id,SenderId,ReceiverId,TransactionDateTime,Reason,Amount,Reference")] TransactionDBModel transaction)
        {
            if (!ModelState.IsValid)
            {
                return(View(transaction));
            }

            bool createResult = _transactionBL.Create(transaction);

            if (!createResult)
            {
                ModelState.AddModelError(string.Empty, "Error");
                return(View(transaction));
            }

            return(RedirectToAction(nameof(Index)));
        }