public async Task <AdminWalletAddDeductApprovalNotificationModel> AdminAddDeductWalletApprovalNotification(int userId)
        {
            AdminWalletAddDeductApprovalNotificationModel response = new AdminWalletAddDeductApprovalNotificationModel();

            response = await _common.AdminAddDeductWalletApprovalNotification(userId);

            return(response);
        }
Пример #2
0
        public async Task <AdminWalletAddDeductApprovalNotificationModel> AdminAddDeductWalletApprovalNotification(int userId)
        {
            AdminWalletAddDeductApprovalNotificationModel adminApprovalNotificationModel = new AdminWalletAddDeductApprovalNotificationModel();

            Console.WriteLine("Connect to SQL Server and demo Create, Read, Update and Delete operations.");
            Console.Write("Connecting to SQL Server ... ");
            using (SqlConnection connection = new SqlConnection(this._connectionString))
            {
                connection.Open();
                Console.WriteLine("Done.");
                using (SqlCommand command = new SqlCommand("admin_wallet_add_deduct_approval_notification", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add("@user_id", SqlDbType.Int).Value = userId;
                    try
                    {
                        using (SqlDataReader reader = await command.ExecuteReaderAsync())
                        {
                            List <AddDeductWallet> withdrawals = new List <AddDeductWallet>();
                            while (reader.Read())
                            {
                                adminApprovalNotificationModel.addRequestCount = Convert.ToInt32(reader["withdrawal_request_count"]);
                            }
                            ;
                            if (reader.NextResult())
                            {
                                while (reader.Read())
                                {
                                    AddDeductWallet pp = new AddDeductWallet();
                                    pp.addwalletid          = Convert.ToInt32(reader["balance_request_id"]);
                                    pp.firstname            = Convert.ToString(reader["first_name"]);
                                    pp.middlename           = Convert.ToString(reader["middle_name"]);
                                    pp.lastname             = Convert.ToString(reader["last_name"]);
                                    pp.comment              = Convert.ToString(reader["comment"]);
                                    pp.createdon            = Convert.ToDateTime(reader["created_on"]);
                                    pp.request_initiator_id = Convert.ToInt32(reader["request_initiator_id"]);
                                    pp.wallet_balance       = Convert.ToDecimal(reader["amount"]);
                                    pp.balance_request_type = Convert.ToString(reader["balance_request_type"]);
                                    withdrawals.Add(pp);
                                }
                            }
                            adminApprovalNotificationModel.addDeductWalletModels = withdrawals;
                            adminApprovalNotificationModel.message = "success";
                        }
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            Console.WriteLine("All done. Press any key to finish...");
            return(adminApprovalNotificationModel);
        }
        public async Task <ActionResult> AdminAddDeductWalletApprovalNotification(int userId)
        {
            AdminWalletAddDeductApprovalNotificationModel response = await rs.AdminAddDeductWalletApprovalNotification(userId);

            return(Ok(response));
        }