public void AddStaffTest()
        {
            StaffDataModel staff = new StaffDataModel
                {
                    Firstname = "chris",
                    Lastname = "essley4",
                    Bio = "cali",
                    Email = "*****@*****.**",
                    Phone = "555-555-5555",
                    IsFemale = false
                };

            int siteId = -40000;

            Staff staffCalls = new Staff(null, null);

            IRestResponse response = staffCalls.AddStaff(siteId, staff);

            Console.WriteLine(response.Content);

            Assert.AreNotEqual(0, response.ContentLength);
        }
Esempio n. 2
0
        public IRestResponse AddStaff(int siteId, StaffDataModel staff)
        {
            var client = new RestClient("http://dev-mobile-connect.mbodev.me");

            var request = new RestRequest("/rest/staff", Method.POST) { RequestFormat = DataFormat.Json };

            request.AddHeader("Content-Type", "application/json");
            request.AddHeader("Authorization", "Bearer " + StaffUserToken.AccessToken);
            request.AddHeader("SiteId", siteId.ToString(CultureInfo.InvariantCulture));

            request.AddBody(
                new
                {
                    firstname = staff.Firstname,
                    lastname = staff.Lastname,
                    bio = staff.Bio,
                    email = staff.Email,
                    phone = staff.Phone,
                    isFemale = staff.IsFemale
                });

            return client.Execute(request);
        }