コード例 #1
0
        public ActionResult UpdateUser(AppUserVM apvm)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            AppUser     toBeUpdatedUser        = _uRep.FirstOrDefault(x => x.ID == apvm.AppUser.ID);
            UserProfile toBeUpdatedUserProfile = _upRep.FirstOrDefault(x => x.ID == apvm.UserProfile.ID);



            toBeUpdatedUser.Email           = apvm.AppUser.Email;
            toBeUpdatedUser.Password        = apvm.AppUser.Password;
            toBeUpdatedUser.ConfirmPassword = apvm.AppUser.ConfirmPassword;
            toBeUpdatedUser.Role            = apvm.AppUser.Role;

            toBeUpdatedUserProfile.FirstName   = apvm.UserProfile.FirstName;
            toBeUpdatedUserProfile.LastName    = apvm.UserProfile.LastName;
            toBeUpdatedUserProfile.MobilePhone = apvm.UserProfile.MobilePhone;
            toBeUpdatedUserProfile.Gender      = apvm.UserProfile.Gender;
            toBeUpdatedUserProfile.Address     = apvm.UserProfile.Address;


            _uRep.Update(toBeUpdatedUser);
            _upRep.Update(toBeUpdatedUserProfile);

            TempData["updateUser"] = $"{toBeUpdatedUserProfile.FirstName} {toBeUpdatedUserProfile.LastName} kişisi başarıyla güncellenmiştir";


            return(RedirectToAction("UserList", "User", new { Area = "Panel" }));
        }