public IHttpActionResult PostTransaction(TransactionDTO transaction) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } transactionService.Create(transaction, UserRecord); return(Json(transaction)); }
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())); }
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))); }