public override ActionResult Save(SocialLinksEditor model) { var person = Services.Person.Get(model.PersonId, false); var social = person.GetPropertyValue <SocialLinks>(true); social.Facebook = model.Facebook; social.GooglePlus = model.GooglePlus; social.Twitter = model.Twitter; social.LinkedIn = model.LinkedIn; social.YouTube = model.YouTube; var prop = (ExtendedProperty)person.GetProperty(ConverterMapping.ConverterAlias); if (prop == null) { prop = new ExtendedProperty { ConverterAlias = ConverterMapping.ConverterAlias }; prop.SetValue(social); person.Properties.Add(prop); } else { prop.SetValue(social); } Services.Person.Save(person, true); return(Redirect(model.ReturnUrl)); }
public void ExtendedProperty_Catalogue() { var cata = new Catalogue(CatalogueRepository, "My cata"); var prop = new ExtendedProperty(CatalogueRepository, cata, "Fish", 5); Assert.AreEqual(5, prop.GetValueAsSystemType()); Assert.IsTrue(prop.IsReferenceTo(cata)); prop.SetValue(10); prop.SaveToDatabase(); Assert.AreEqual(10, prop.GetValueAsSystemType()); Assert.IsTrue(prop.IsReferenceTo(cata)); prop.RevertToDatabaseState(); Assert.AreEqual(10, prop.GetValueAsSystemType()); Assert.IsTrue(prop.IsReferenceTo(cata)); var prop2 = CatalogueRepository.GetObjectByID <ExtendedProperty>(prop.ID); Assert.AreEqual(10, prop.GetValueAsSystemType()); Assert.IsTrue(prop.IsReferenceTo(cata)); }