Example #1
0
        public static string sincronizeOdooContacts()
        {
            var response = new RequestAPI()
                           .addClient(new RestClient(urlRequest))
                           .addRequest(new RestRequest("contact/sync", Method.POST, DataFormat.Json))
                           .addHeader(new KeyValuePair <string, object>("Accept", "application/json"))
                           .buildRequest();

            return(RequestAPI.deserilizeProject <string>(response));
        }
Example #2
0
        public static List <CompanyModel> getAll()
        {
            var response = new RequestAPI()
                           .addClient(new RestClient(urlRequest))
                           .addRequest(new RestRequest("membership", Method.GET, DataFormat.Json))
                           .addHeader(new KeyValuePair <string, object>("Accept", "application/json"))
                           .buildRequest();

            return(RequestAPI.deserilizeProject <List <CompanyModel> >(response));
        }
Example #3
0
        public static List <TruckModel> update(TruckModel truck)
        {
            var response = new RequestAPI()
                           .addClient(new RestClient(urlRequest))
                           .addRequest(new RestRequest("truck/update/", Method.GET, DataFormat.Json))
                           .addHeader(new KeyValuePair <string, object>("Accept", "application/json"))
                           .addBodyData(truck)
                           .buildRequest();

            return(RequestAPI.deserilizeProject <List <TruckModel> >(response));
        }
Example #4
0
        public static List <TaskConfigurationModel> refreshTasks(TaskConfigurationModel taskToUpdate)
        {
            var response = new RequestAPI()
                           .addClient(new RestClient(urlRequest))
                           .addRequest(new RestRequest("taskConfiguration/updateAllowDocsAndDisplayClient", Method.PUT, DataFormat.Json))
                           .addHeader(new KeyValuePair <string, object>("Accept", "application/json"))
                           .addBodyData(taskToUpdate)
                           .buildRequest();
            TaskConfigurationModel userRefreshed = RequestAPI.deserilizeProject <TaskConfigurationModel>(response);

            return(getAll());
        }
Example #5
0
        public static List <UsuarioModel> sendPassword(int userId)
        {
            var response = new RequestAPI()
                           .addClient(new RestClient(urlRequest))
                           .addRequest(new RestRequest("user/firstPassword/{userId}", Method.PUT, DataFormat.Json))
                           .addHeader(new KeyValuePair <string, object>("Accept", "application/json"))
                           .addUrlSegmentParam(new KeyValuePair <string, object> ("userId", userId))
                           .buildRequest();
            UsuarioModel userRefreshed = RequestAPI.deserilizeProject <UsuarioModel>(response);

            return(getAll());
        }
Example #6
0
        public static List <UsuarioModel> refreshUsers(UsuarioModel userToUpdate)
        {
            var response = new RequestAPI()
                           .addClient(new RestClient(urlRequest))
                           .addRequest(new RestRequest("user/updatePrivileges", Method.PUT, DataFormat.Json))
                           .addHeader(new KeyValuePair <string, object>("Accept", "application/json"))
                           .addBodyData(userToUpdate)
                           .buildRequest();
            UsuarioModel userRefreshed = RequestAPI.deserilizeProject <UsuarioModel>(response);

            return(getAll());
        }
Example #7
0
        public static List <ServiceViewModel> getByCompany()
        {
            List <ServiceViewModel> listCompanyService = new List <ServiceViewModel>();
            List <CompanyModel>     companyList        = CompanyDAL.getAll();

            foreach (CompanyModel company in companyList)
            {
                string nameCompany = company.company;
                var    response    = new RequestAPI()
                                     .addClient(new RestClient(urlRequest))
                                     .addRequest(new RestRequest("service/{nameCompany}", Method.GET, DataFormat.Json))
                                     .addHeader(new KeyValuePair <string, object>("Accept", "application/json"))
                                     .addBodyData(nameCompany)
                                     .buildRequest();
                listCompanyService.Add(new ServiceViewModel()
                {
                    companyName = nameCompany,
                    serviceList = RequestAPI.deserilizeProject <List <ServiceModel> >(response)
                });
            }
            return(listCompanyService);
        }