public ProfilePropertyViewModel(SettingsProperty property, ProfilePropertyInputModel value)
        {
            Type        = PropTypeFromPropertyType(property);
            Description = string.Format(property.PropertyType.IsValueType
                                            ? Resources.ProfilePropertyViewModel.RequiredPropertyMustBeOfType
                                            : Resources.ProfilePropertyViewModel.RequiredProperty,
                                        property.Name, property.PropertyType.Name);

            Data = value;
        }
        public ProfilePropertyViewModel(SettingsProperty property, ProfilePropertyInputModel value)
        {
            Type = PropTypeFromPropertyType(property);
            Description = string.Format(property.PropertyType.IsValueType
                                            ? Resources.ProfilePropertyViewModel.RequiredPropertyMustBeOfType
                                            : Resources.ProfilePropertyViewModel.RequiredProperty,
                                        property.Name, property.PropertyType.Name);

            Data = value;
        }
        public UserProfileViewModel(string username, ProfilePropertyInputModel[] values)
        {
            this.Username = username;
            this.ProfileValues = new ProfilePropertyViewModel[values.Length];

            for (int i = 0; i < this.ProfileValues.Length; i++)
            {
                var prop = ProfileBase.Properties[values[i].Name];
                this.ProfileValues[i] = new ProfilePropertyViewModel(prop, values[i]);
            }
        }
Esempio n. 4
0
        public new ActionResult Profile(string username, ProfilePropertyInputModel[] profileValues)
        {
            var vm = new UserProfileViewModel(username, profileValues);

            if (vm.UpdateProfileFromValues(ModelState))
            {
                TempData["Message"] = Resources.UserController.ProfileUpdated;
                return RedirectToAction("Profile", new { username });
            }

            return View(vm);
        }