Example #1
0
        public ActionResult UpdateProfile(uiModel.Person person, FormCollection frm)
        {
            person.Image    = GetPersonImage(person.Avatar);
            person.ImageUrl = GetPersonImageUrl(person.Avatar, LocalImageUrl, person.Twitter, frm["cbTwitter"] == "on");

            service.UpdatePerson(person.Transform());

            this.CurrentUser = person;

            return(RedirectToAction("Index", "Home"));
        }
Example #2
0
        public ActionResult UpdateProfile(uiModel.Person person, FormCollection frm)
        {
            bool useTwitter = frm["cbTwitter"] == "on";

            if (person.Avatar != null)
            {
                person.ImageUrl = GetImageInfo(person.Avatar, "/Content/avatar");
            }
            else if (useTwitter)
            {
                person.ImageUrl = GetImageInfo(person.Twitter, LocalImageUrl);
            }
            else
            {
                person.ImageUrl = LocalImageUrl;
            }

            //string txtAvatarURL = frm["txtAvatarURL"];
            //bool useTwitter = frm["cbTwitter"] == "on";
            //if (useTwitter)
            //    person.ImageUrl = GetImageInfo(person.Twitter, localImageUrl);
            //else
            //    person.ImageUrl = string.IsNullOrEmpty(txtAvatarURL) ? localImageUrl : txtAvatarURL;


            //TODO - Can't update avatar after initial save due to filesystem security
            //if (String.IsNullOrEmpty(person.ImageUrl))
            //{
            //    person.ImageUrl = this.GetImageInfo(person.Avatar);
            //}
            //else
            //{
            //    string tempPersonUri = person.ImageUrl;
            //    person.ImageUrl =
            //        string.Format("{0}.{1}",
            //                      DateTime.UtcNow.Ticks.ToString(CultureInfo.InvariantCulture),
            //                      tempPersonUri);
            //    person.Avatar.FileName = person.ImageUrl;
            //}
            service.UpdatePerson(person.Transform());

            this.CurrentUser = person;

            return(RedirectToAction("Index", "Home"));
        }