Exemplo n.º 1
0
        // private static CommonPage _commonPage = UnityContainerFactory.GetContainer().Resolve<CommonPage>();

        //example
        public static IRestResponse CreateUser(string name, string job)
        {
            string queryBody;

            createUser cus = new createUser();

            cus.name = name;
            cus.job  = job;

            queryBody = SimpleJson.SerializeObject(cus);

            return(CommonAPICall.APICall(Method.POST, "api/users", queryBody));
        }
        //example
        public static void createCustomer(string fname, string lname, int dob)
        {
            string queryBody;

            Customer cus = new Customer();

            cus.fname = fname;
            cus.lname = lname;
            cus.dob   = dob;

            queryBody = SimpleJson.SerializeObject(cus);

            _commonPage.APIResponse = CommonAPICall.APICall(Method.POST, "/createcustomer", queryBody);
        }
        //example
        public static void UpdateCustomer(int cusId, string fname, string lname, int DateOfBirth)
        {
            string queryBody;

            Customer cus = new Customer();

            cus.cusID = cusId;
            cus.fname = fname;
            cus.lname = lname;
            cus.dob   = DateOfBirth;

            queryBody = SimpleJson.SerializeObject(cus);

            _commonPage.APIResponse = CommonAPICall.APICall(Method.PUT, "/customer/" + cusId, queryBody);
        }
        //example
        public static IRestResponse UpdateCustomer(int cusId, string name, string job)
        {
            string queryBody;

            Updateuser cus = new Updateuser();

            cus.name = name;
            cus.job  = job;

            queryBody = SimpleJson.SerializeObject(cus);

            _commonPage.APIResponse = CommonAPICall.APICall(Method.PUT, "api/users/" + cusId, queryBody);

            return(_commonPage.APIResponse);
        }
Exemplo n.º 5
0
        //example
        public static IRestResponse RegisterUSer(string email, string password)
        {
            string queryBody;

            registerUser cus = new registerUser();

            cus.email    = email;
            cus.password = password;

            queryBody = SimpleJson.SerializeObject(cus);

            _commonPage.APIResponse = CommonAPICall.APICall(Method.POST, "api/register", queryBody);

            return(_commonPage.APIResponse);
        }
 //example
 public static IRestResponse  getUser(int cusID)
 {
     return(CommonAPICall.APICall(Method.GET, "api/users/" + cusID));
 }
Exemplo n.º 7
0
 //example
 public static void getCustomer(int cusID)
 {
     _commonPage.APIResponse = CommonAPICall.APICall(Method.GET, "/customer/" + cusID);
 }
 //example
 public static void DeleteCustomer(int cusID)
 {
     _commonPage.APIResponse = CommonAPICall.APICall(Method.DELETE, "\\customer\\" + cusID + "\\delete");
 }
 //example
 public static IRestResponse getUser()
 {
     return(CommonAPICall.APICall(Method.GET, "api/users?page=2"));
 }
        //example
        public static IRestResponse DeleteCustomer(int cusID)
        {
            _commonPage.APIResponse = CommonAPICall.APICall(Method.DELETE, "api/users/" + cusID);

            return(_commonPage.APIResponse);
        }