public ActionResult Settings()
        {
            var model = new SettingsUserViewModel();

            var user = repo.SingleOrDefault(User.Identity.GetUserId());

            if (user != null)
            {
                model.FirstName = user.FirstName ?? string.Empty;
                model.LastName  = user.LastName ?? string.Empty;
                model.UserImage = user.UserImage ?? string.Empty;
            }

            return(View(model));
        }
        public ActionResult Settings(SettingsUserViewModel model)
        {
            var user = repo.SingleOrDefault(User.Identity.GetUserId());

            if (user != null)
            {
                if (model.FirstName != null)
                {
                    user.FirstName = model.FirstName;
                }
                if (model.LastName != null)
                {
                    user.LastName = model.LastName;
                }

                repo.Update(user);
            }


            return(View(model));
        }
Example #3
0
        public SettingsUserDialog(IBusiness _business, int _id)
        {
            InitializeComponent();

            DataContext = new SettingsUserViewModel(_business, _id);
        }