I have two class Libraries, one for my "backend" Code and one for the WebInterface side of the project.
I'm passing two variables (UserId and EnvId) using Ajax/Jquery to my Controller in the WebInterface side of my project. I then need to pass the two values from the Var's to the other Class Library to run several methods for unlocking user accounts.
Below is the code from my Controller (the code here currently post console.log messages back to the browser to I know I'm getting the right ID's)
[HttpPost]
public ActionResult UnlockUserAction(string UserId, string EnvId)
{
var user = UserId;
var environment = EnvId;
if (user == "" || user == "0")
{
return Json("Error - The User doesn't exist or there was an error", JsonRequestBehavior.AllowGet);
}
else
{
//pass userid & envid to UnlockUser Class will go here
var result = user + " | " + environment;
return Json(result, JsonRequestBehavior.AllowGet);
}
}
This is my code from the "backend" Class Library;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
namespace UserImportInterfaceLibrary
{
public class UnlockUser
{
//Get Environment SQL
public string sql = "SELECT Server,Catalog,UserName,UserPwd FROM tbl_Environments WHERE Description = @environment";
//Unlock User String
public string unlockSQL = "UPDATE User_Account_Data SET Account_Locked = 0 WHERE User_ID = @userid";
public void getEnvironment(EnvId)
{
var envData = EnvId;
}
}
}
var bob = new UnlockUser(); bob.WhateverYouNeedToDoHere(parametersHere);