Ejemplo n.º 1
0
        public static void CopyFrom(this Person source, UserProfileModel copied)
        {
            if(source.Profile == null)
                source.Profile = new PersonProfile();

            source.Profile.FirstName = copied.FirstName;
            source.Profile.LastName = copied.LastName;
            source.Profile.MiddleName = copied.MiddleName;
            source.Profile.PhoneHome = copied.PhoneHome;
            source.Profile.PhoneMobile = copied.PhoneMobile;
            source.Profile.Email = copied.Email;

            if (source.DeliveryAddress == null)
                source.DeliveryAddress = new Address();

            source.DeliveryAddress.Address1 = copied.Address1;
            source.DeliveryAddress.City = copied.City;
        }
Ejemplo n.º 2
0
        public static void CopyFrom(this Person source, UserProfileModel copied)
        {
            if (source.Profile == null)
            {
                source.Profile = new PersonProfile();
            }

            source.Profile.FirstName   = copied.FirstName;
            source.Profile.LastName    = copied.LastName;
            source.Profile.MiddleName  = copied.MiddleName;
            source.Profile.PhoneHome   = copied.PhoneHome;
            source.Profile.PhoneMobile = copied.PhoneMobile;
            source.Profile.Email       = copied.Email;

            if (source.DeliveryAddress == null)
            {
                source.DeliveryAddress = new Address();
            }

            source.DeliveryAddress.Address1 = copied.Address1;
            source.DeliveryAddress.City     = copied.City;
        }
Ejemplo n.º 3
0
        public ActionResult UpdateUserProfile(UserProfileModel user)
        {
            if (ModelState.IsValid)
            {
                if (user.Id == Guid.Empty)
                    return View("UserProfile");

                var person = Repository.Data.Get<Person>(user.Id);
                person.CopyFrom(user);
                ActionHelper.TryExecute(() => Repository.Data.Save(person), ModelState);
                if (ModelState.IsValid)
                    ViewBag.Message = WebStroreResource.UpdateProfileSuccessful;
            }

            return View("UserProfile");
        }