public Transaction Post([FromBody] Transaction pTransaction) { Transaction p = pTransaction; try { p = new TransactionDataHandler().SaveTransaction(pTransaction); } catch (Exception ex) { } return(p); }
public JsonResult getAllActivity(int userId) { Response response = new Response(); try { TransactionDataHandler transactionDataHandler = new TransactionDataHandler(config); List <ActivityViewModel> activityViewModels = transactionDataHandler.getAllActivity(userId); response.status = true; response.data = JsonConvert.SerializeObject(activityViewModels); } catch (Exception ex) { response.message = ex.Message; } return(Json(response)); }
private JsonResult saveTransaction(Transaction transaction, string command) { bool result = false; TransactionDataHandler transactionDataHandler = new TransactionDataHandler(config); transactionDataHandler.transactionId = transaction.transactionId; transactionDataHandler.userId = transaction.userId; transactionDataHandler.title = transaction.title; transactionDataHandler.type = transaction.type; transactionDataHandler.amount = transaction.amount; transactionDataHandler.friendId = transaction.friendId; transactionDataHandler.transactionPicture = transaction.transactionPicture; transactionDataHandler.dateCreated = transaction.dateCreated; transactionDataHandler.dateUpdated = transaction.dateUpdated; if (command.Equals("create")) { result = transactionDataHandler.createTransaction(); } Response response = new Response(); response.status = result; return(Json(response)); }