public ProfilePropertyViewModel(SettingsProperty property, ProfilePropertyInputModel value)
 {
     Type = PropTypeFromPropertyType(property);
     Description = property.Name + " must be of type " + property.PropertyType.Name;
     if (property.PropertyType.IsValueType) Description += " and is required";
     Description += ".";
     Data = value;
 }
Esempio n. 2
0
        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 ProfilePropertyViewModel(SettingsProperty property, ProfilePropertyInputModel value)
 {
     Type        = PropTypeFromPropertyType(property);
     Description = property.Name + " must be of type " + property.PropertyType.Name;
     if (property.PropertyType.IsValueType)
     {
         Description += " and is required";
     }
     Description += ".";
     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 new ActionResult Profile(string id, ProfilePropertyInputModel[] profileValues)
        {
            var vm = new UserProfileViewModel(id, profileValues);

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

            return View(vm);
        }