Exemplo n.º 1
0
 public EditProfileInput(Profile profile)
 {
     Username = profile.Username;
     FirstName = profile.FirstName;
     LastName = profile.LastName;
     Email = profile.Email;
 }
Exemplo n.º 2
0
 public ProfileEditModel(Profile profile)
 {
     Username = profile.Username;
     FirstName = profile.FirstName;
     LastName = profile.LastName;
     Email = profile.Email;
 }
Exemplo n.º 3
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());
        }
        public ViewResult Show(string username)
        {
            var profile = _profileRepository.Find(username);
            if (profile == null)
            {
                profile = new Profile(username);
                _profileRepository.Add(profile);
            }

            return View(profile);
        }
Exemplo n.º 5
0
        public ViewResult Show(string username)
        {
            var profile = _profileRepository.Find(username);
            if (profile == null)
            {
                profile = new Profile(username);
                _profileRepository.Add(profile);
            }

            bool hasPermission = User.Identity.Name == username;

            ViewData["hasPermission"] = hasPermission;

            return View(profile);
        }
Exemplo n.º 6
0
 public void Add(Profile profile)
 {
     _profiles.Add(profile);
 }
Exemplo n.º 7
0
 public LogOnWidgetModel(bool isAuthenticated, Profile profile)
 {
     IsAuthenticated = isAuthenticated;
     Profile = profile;
 }
Exemplo n.º 8
0
        public Profile Find(string username)
        {
            var profile = _profiles.FirstOrDefault(p => p.Username == username);
            if (profile == null)
            {
                profile = new Profile(username);
                Add(profile);
            }

            return profile;
        }
        public ViewResult LogOnWidget()
        {
            bool isAuthenticated = Request.IsAuthenticated;
            Profile profile = null;

            if (isAuthenticated)
            {
                var username = HttpContext.User.Identity.Name;
                profile = _profileRepository.Find(username);
                if (profile == null)
                {
                    profile = new Profile(username);
                    _profileRepository.Add(profile);
                }
            }

            return View(new LogOnWidgetModel(isAuthenticated, profile));
        }