public ActionResult UpdateUserProfile(UpdateProfileViewModel vm) { using (var client = new UserProfileServiceReference.UserProfileServiceClient()) { int.TryParse(Session["UserId"].ToString(), out int userid); var Userinfo = client.GetUserByUserId(userid); var updateUser = new UserProfileServiceReference.User() { Address = vm.userAddress, City = vm.userCity, PersonalCodeNumber = vm.personalnumber, Phonenumber = vm.userPhoneNumber, Picture = vm.userProfilePicture, ZipCode = vm.userZipCode, Id = userid, Email = Userinfo.Email, Name = Userinfo.Name, Surname = Userinfo.Surname, Username = Userinfo.Username, }; var user = client.UpdateUser(updateUser); } return(View()); }
public ActionResult EditProfile(EditProfileViewModel vm) { using (var client = new UserProfileServiceReference.UserProfileServiceClient()) { int.TryParse(Session["UserId"].ToString(), out int userid); var Userinfo = client.GetUserByUserId(userid); var updateUser = new UserProfileServiceReference.User() { PersonalCodeNumber = vm.PersonalCodeNumber, Address = vm.UserAddress, City = vm.UserCity, Phonenumber = vm.UserPhoneNumber, Picture = vm.UserProfilePicture, ZipCode = vm.UserZipCode, Id = userid, Email = Userinfo.Email, Name = Userinfo.Name, Surname = Userinfo.Surname, Username = Userinfo.Username, }; var user = client.UpdateUser(updateUser); } if (!ModelState.IsValid) { return(View()); } else { return(RedirectToAction("Index")); } }
public ActionResult UpdateAccountInformation(EditProfileViewModel vm) { using (var client = new UserProfileServiceReference.UserProfileServiceClient()) { var updateUser = new UserProfileServiceReference.User() { Address = vm.UserAddress, City = vm.UserCity, Email = vm.UserEmail, Phonenumber = vm.UserPhoneNumber, Picture = vm.UserProfilePicture, ZipCode = vm.UserZipCode, Id = vm.UserId, }; var user = client.UpdateUser(updateUser); } return(View("Index")); }
public ActionResult UpdateUserProfile(UpdateProfileViewModel vm) { using (var client = new UserProfileServiceReference.UserProfileServiceClient()) { int.TryParse(Session["UserId"].ToString(), out int userid); var Userinfo = client.GetUserByUserId(userid); var updateUser = new UserProfileServiceReference.User() { Address = vm.userAddress, City = vm.userCity, PersonalCodeNumber = vm.personalnumber, Phonenumber = vm.userPhoneNumber, Picture = vm.userProfilePicture, ZipCode = vm.userZipCode, Id = userid, Email = Userinfo.Email, Name = Userinfo.Name, Surname = Userinfo.Surname, Username = Userinfo.Username, }; var user = client.UpdateUser(updateUser); } using (var client = new UserLoginServiceReference.LoginServiceClient()) { if (client.UsernameExist(vm.username)) { ViewBag.Message = "Det valda Användarnamnet finns redan"; } else { return(RedirectToAction("Index", "UserProfile")); } } return(View()); }