예제 #1
0
        private MapIdentityViewModel GetMapIdentityViewModel(int id)
        {
            var model = new MapIdentityViewModel
            {
                User = _usersResource.Get(id),
                BlogUsers = GetBlogUsers()
            };

            return model;
        }
예제 #2
0
        public ActionResult Map(MapIdentityViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    model.BlogUsers = model.BlogUsers ?? GetBlogUsers();
                    return View(model);
                }

                var user = model.User;
                user.IdentityId = model.SelectedIdentityId;

                _usersResource.Update(user);
                return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                _errorSignaler.SignalFromCurrentContext(ex);
                ViewBag.ErrorMessage = ex.Message;

                model.BlogUsers = model.BlogUsers ?? GetBlogUsers();
                return View(model);
            }
        }