AccountProfile.Models.ProfileRepository.Add C# (CSharp) Method

Add() public method

public Add ( Profile profile ) : void
profile Profile
return void
        public void Add(Profile profile)
        {
            _profiles.Add(profile);
        }

Usage Example

Example #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);

            var repository = new ProfileRepository();

            var firstNames = new[]
            {
                "Jacob", "Michael", "Ethan", "Joshua", "Daniel", "Alexander", "Anthony", "William", "Chris", "Matthew", "Emma",
                "Isabella", "Emily", "Madison", "Ava", "Olivia", "Sofia", "Abigail", "Elizabeth", "Chloe"
            };
            var lastNames = new[]
            {
                "Smith", "Johnson", "Williams", "Jones", "Brown", "Davis", "Miller", "Wilson", "Moore", "Taylor", "Anderson",
                "Thomas", "Jackson", "White", "Harris", "Martin", "Thompson", "Robinson", "Clark", "Lewis", "Lee", "Walker"
            };

            var rand = new Random((int) DateTime.Now.Ticks);

            for (int i = 0; i < 100; i++)
            {
                var firstName = firstNames[rand.Next(firstNames.Length)];
                var lastName = lastNames[rand.Next(lastNames.Length)];
                var username = Guid.NewGuid().ToString().Substring(0, 8);
                var profile = new Profile(username) {FirstName = firstName, LastName = lastName};

                repository.Add(profile);
            }

            InputBuilder.BootStrap();
            InputBuilder.SetPropertyConvention(() => new InputBuilderPropertyFactory());
        }