/// <summary>Snippet for CreateProfile</summary>
 public void CreateProfile()
 {
     // Snippet: CreateProfile(string, Profile, CallSettings)
     // Create client
     ProfileServiceClient profileServiceClient = ProfileServiceClient.Create();
     // Initialize request argument(s)
     string  parent  = "projects/[PROJECT]/tenants/[TENANT]";
     Profile profile = new Profile();
     // Make the request
     Profile response = profileServiceClient.CreateProfile(parent, profile);
     // End snippet
 }
 /// <summary>Snippet for CreateProfile</summary>
 public void CreateProfileResourceNames()
 {
     // Snippet: CreateProfile(TenantName, Profile, CallSettings)
     // Create client
     ProfileServiceClient profileServiceClient = ProfileServiceClient.Create();
     // Initialize request argument(s)
     TenantName parent  = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]");
     Profile    profile = new Profile();
     // Make the request
     Profile response = profileServiceClient.CreateProfile(parent, profile);
     // End snippet
 }
 /// <summary>Snippet for CreateProfile</summary>
 public void CreateProfile()
 {
     // Snippet: CreateProfile(CompanyName,Profile,CallSettings)
     // Create client
     ProfileServiceClient profileServiceClient = ProfileServiceClient.Create();
     // Initialize request argument(s)
     CompanyName parent  = new CompanyName("[PROJECT]", "[COMPANY]");
     Profile     profile = new Profile();
     // Make the request
     Profile response = profileServiceClient.CreateProfile(parent, profile);
     // End snippet
 }
        public void AddContactsTest()
        {
            ProfileServiceClient client = new ProfileServiceClient();

            string spidermanID = client.CreateProfile("spiderman", "morpheus", "*****@*****.**", "Peter", "Parker");
            string batmanID = client.CreateProfile("batman", "morpheus", "*****@*****.**", "Bruce", "Wayne");
            string supermanID = client.CreateProfile("superman", "morpheus", "*****@*****.**", "Clark", "Kent");

            List<Profile> profiles = client.GetAllProfiles();

            Assert.AreEqual<int>(3, profiles.Count);

            client.AddContact(spidermanID, batmanID);
            client.AddContact(batmanID, supermanID);
            client.AddContacts(supermanID, new ArrayOfguid { spidermanID, batmanID });

            List<Profile> spidermanContacts = client.GetContacts(spidermanID);
            Assert.AreEqual<int>(2, spidermanContacts.Count);

            List<Profile> batmanContacts = client.GetContacts(batmanID);
            Assert.AreEqual<int>(3, batmanContacts.Count);

            List<Profile> supermanContacts = client.GetContacts(supermanID);
            Assert.AreEqual<int>(3, supermanContacts.Count);

            client.RemoveAllContacts(spidermanID);
            client.RemoveAllContacts(batmanID);
            client.RemoveAllContacts(supermanID);

            client.DeleteProfile(spidermanID);
            client.DeleteProfile(batmanID);
            client.DeleteProfile(supermanID);

            profiles = client.GetAllProfiles();

            Assert.AreEqual<int>(0, profiles.Count);
        }
 /// <summary>Snippet for CreateProfile</summary>
 public void CreateProfileRequestObject()
 {
     // Snippet: CreateProfile(CreateProfileRequest, CallSettings)
     // Create client
     ProfileServiceClient profileServiceClient = ProfileServiceClient.Create();
     // Initialize request argument(s)
     CreateProfileRequest request = new CreateProfileRequest
     {
         ParentAsTenantName = TenantName.FromProjectTenant("[PROJECT]", "[TENANT]"),
         Profile            = new Profile(),
     };
     // Make the request
     Profile response = profileServiceClient.CreateProfile(request);
     // End snippet
 }
 /// <summary>Snippet for CreateProfile</summary>
 public void CreateProfile_RequestObject()
 {
     // Snippet: CreateProfile(CreateProfileRequest,CallSettings)
     // Create client
     ProfileServiceClient profileServiceClient = ProfileServiceClient.Create();
     // Initialize request argument(s)
     CreateProfileRequest request = new CreateProfileRequest
     {
         ParentAsCompanyName = new CompanyName("[PROJECT]", "[COMPANY]"),
         Profile             = new Profile(),
     };
     // Make the request
     Profile response = profileServiceClient.CreateProfile(request);
     // End snippet
 }
Example #7
0
        public ActionResult CreateProfile(FormCollection collection)
        {
            var nickname = collection["nickname"];
            var username = collection["username"];
            var email    = collection["email"];
            ProfileServiceClient client = new ProfileServiceClient();
            Profile profile             = new Profile
            {
                Username = username,
                Nickname = nickname,
                Email    = email,
            };
            int i = client.CreateProfile(profile);

            ViewBag.i = i;
            return(View());
        }
        public void CreateProfile()
        {
            ProfileServiceClient client = new ProfileServiceClient();

            string spidermanID = client.CreateProfile("spiderman", "morpheus", "*****@*****.**", "Peter", "Parker");
            string batmanID = client.CreateProfile("batman", "morpheus", "*****@*****.**", "Bruce", "Wayne");
            string supermanID = client.CreateProfile("superman", "morpheus", "*****@*****.**", "Clark", "Kent");

            List<Profile> profiles = client.GetAllProfiles();

            Assert.AreEqual<int>(3, profiles.Count);

            client.DeleteProfile(spidermanID);
            client.DeleteProfile(batmanID);
            client.DeleteProfile(supermanID);

            profiles = client.GetAllProfiles();

            Assert.AreEqual<int>(0, profiles.Count);
        }
Example #9
0
        static void Main(string[] args)
        {
            ProfileServiceClient client = new ProfileServiceClient("WSHttpBinding_ProfileService");

            // AddProfile
            Profile newProfile = new Profile()
            {
                Username = "******",
                Password = "******",
                Name = "Guillermo",
                Surname = "Schlereth Lamas",
                Email = "*****@*****.**",
                DateOfBirth = DateTime.Parse("12/06/1972"),
                Description = "Hola soy Guillermo",
                Gender = Gender.Male,
                Address = new Address() { Street = "Federico Mompou, 3", City = "Torremolinos", PostalCode = "29620" }
            };

            Guid guilleID = client.AddProfile(newProfile);

            newProfile = new Profile()
            {
                Username = "******",
                Password = "******",
                Name = "Lidia",
                Surname = "Lluch Fuentes",
                Email = "*****@*****.**",
                DateOfBirth = DateTime.Parse("21/07/1973"),
                Description = "Hola soy Lidia",
                Gender = Gender.Female,
                Address = new Address() { Street = "Federico Mompou, 3", City = "Torremolinos", PostalCode = "29620" }
            };

            Guid lidiaID = client.AddProfile(newProfile);

            newProfile = new Profile()
            {
                Username = "******",
                Password = "******",
                Name = "Liam",
                Surname = "Schlereth Lluch",
                Email = "*****@*****.**",
                DateOfBirth = DateTime.Parse("25/03/2008"),
                Description = "Hola soy Liam",
                Gender = Gender.Male,
                Address = new Address() { Street = "Federico Mompou, 3", City = "Torremolinos", PostalCode = "29620" }
            };

            Guid liamID = client.AddProfile(newProfile);

            // CreateProfile
            Guid sergioID = client.CreateProfile("sergio", "admin123", "*****@*****.**", "Sergio", "Schlereth Lamas");
            Guid mariaID = client.CreateProfile("mariluz", "admin123", "*****@*****.**", "Mariluz", "Schlereth Lamas");
            Guid pericoID = client.CreateProfile("perico", "admin123", "*****@*****.**", "Pedro", "Delgado");

            // GetAllProfiles
            List<Profile> allProfiles = client.GetAllProfiles();
            WriteProfiles(allProfiles, "All profiles -->");

            // GetProfileByID and GetProfileByCredentials
            Profile liamProfile = client.GetProfileByID(liamID);
            Profile sergioProfile = client.GetProfileByID(sergioID);
            Profile lidiaProfile = client.GetProfileByCredentials("lidia", "admin123");

            List<Profile> selectProfiles = new List<Profile>();
            selectProfiles.Add(liamProfile);
            selectProfiles.Add(sergioProfile);
            selectProfiles.Add(lidiaProfile);
            WriteProfiles(selectProfiles, "Liam, Sergio and Lidia profiles -->");

            // ModifyProfile
            sergioProfile.Description = "Hola soy Sergio ...";
            sergioProfile.Email = "*****@*****.**";
            sergioProfile.DateOfBirth = DateTime.Parse("25/06/1986");
            sergioProfile.Gender = Gender.Male;
            sergioProfile.Address = new Address
            {
                Street = "Avda. Bellamina, 3",
                City = "Torremolinos",
                PostalCode = "29620"
            };

            client.ModifyProfile(sergioProfile);
            WriteProfiles(new List<Profile>() { client.GetProfileByID(sergioID) }, "Sergio profile modified -->");

            // DeleteProfile
            client.DeleteProfile(pericoID);
            WriteProfiles(client.GetAllProfiles(), "Perico profile deleted -->");

            // SearchProfiles
            ProfileFilter filter = new ProfileFilter()
            {
                Street = "Mompou"
            };

            List<Profile> searchResult = client.SearchProfiles(filter);
            WriteProfiles(searchResult, "Profiles living in Mompou street -->");

            // AddContact
            client.AddContact(guilleID, lidiaID);
            client.AddContact(guilleID, liamID);

            // AddContacts
            client.AddContacts(guilleID, new List<Guid>() { sergioID, mariaID });

            // GetContacts
            WriteProfiles(client.GetContacts(guilleID), "Guille contacts -->");

            // RemoveContact
            client.RemoveContact(guilleID, sergioID);
            WriteProfiles(client.GetContacts(guilleID), "Sergio removed from guille contacts -->");

            // RemoveAllContacts
            client.RemoveAllContacts(guilleID);
            WriteProfiles(client.GetContacts(guilleID), "Guille contacts removed -->");

            // Delete Profiles
            client.DeleteProfile(guilleID);
            client.DeleteProfile(lidiaID);
            client.DeleteProfile(sergioID);
            client.DeleteProfile(mariaID);
            client.DeleteProfile(liamID);

            WriteProfiles(client.GetAllProfiles(), "All contacts deleted -->");

            Console.ReadLine();
        }