예제 #1
0
        public IActionResult Edit(ProfileManageVM profileVM)
        {
            // When the model state is valid
            if (ModelState.IsValid)
            {
                // Get the current user setting
                var currentUser = _userSettingRepo.Read(User.Identity.Name);
                // Get the user setting from the identity user found
                var userSetting = profileVM.GetInstance(currentUser);

                // Update the user's setting profile to what the user wants
                _userSettingRepo.Update(User.Identity.Name, userSetting, profileVM.NewsCategoryNames);
                return(RedirectToAction("Index"));
            }

            return(View(profileVM));
        }