示例#1
0
        public ActionResult Edit(SpeakersEditModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Edit", model));
            }

            var user = GetUser(model.SpeakerId, true);

            user.UpdateSpeakerProfile(model.Bio, model.ImageUrl, model.BlogUrl, model.IsMvp, model.MvpProfileUrl, model.TravelAssistance);
            _repository.Save(user);

            return(RedirectTo <SpeakersController>(c => c.Show(user.Id, user.UrlName)));
        }
示例#2
0
        public ActionResult Edit(int id)
        {
            var user = GetUser(id, true);

            var model = new SpeakersEditModel
            {
                SpeakerId = user.Id,
                Name      = user.Name,
                Email     = user.Email,
            };

            if (user.SpeakerProfile != null)
            {
                model.Bio              = user.SpeakerProfile.Biography;
                model.ImageUrl         = user.SpeakerProfile.ImageUrl.ToUri();
                model.BlogUrl          = user.SpeakerProfile.BlogUrl.ToUri();
                model.IsMvp            = user.SpeakerProfile.IsMvp;
                model.MvpProfileUrl    = user.SpeakerProfile.MvpProfileUrl.ToUri();
                model.TravelAssistance = user.SpeakerProfile.TravelAssistance;
            }

            return(View("Edit", model));
        }
示例#3
0
 public ActionResult Create(SpeakersEditModel model)
 {
     return(Edit(model));
 }