コード例 #1
0
ファイル: UserManager.cs プロジェクト: pisanina/CodeTogether
        public int SaveProfile(MySettingsViewModel Data)
        {
            using (UserDataContext db = new UserDataContext())
            {
                var User = db.tblUserData.Single(o => o.UserName.Equals(Data.UserName));
                if (Data.ConfirmPassword == User.UserPassword)
                {
                    User.UserName  = Data.UserName;
                    User.Email     = Data.Email;
                    User.FirstName = Data.FirstName;
                    User.LastName  = Data.LastName;
                    User.Gender    = Data.Gender;
                    User.BirthDate = Data.BirthDate;

                    var Address = db.tblAddress.Single(o => o.ID.Equals(User.AddressID));
                    Address.Country         = Data.Country;
                    Address.City            = Data.City;
                    Address.Region          = Data.Region;
                    Address.ZipCode         = Data.ZipCode;
                    Address.Street          = Data.Street;
                    Address.Number          = Data.Number;
                    Address.ApartmentNumber = Data.ApartmentNumber;

                    db.SaveChanges();
                    return(0);
                }

                else
                {
                    return(1);
                }
            }
        }
コード例 #2
0
ファイル: UserManager.cs プロジェクト: pisanina/CodeTogether
        public MySettingsViewModel MyProfile()
        {
            MySettingsViewModel MyProfileView = new MySettingsViewModel();

            using (UserDataContext db = new UserDataContext())
            {
                var UserName    = HttpContext.Current.User.Identity.Name;
                var User        = db.tblUserData.Single((o => o.UserName.Equals(UserName)));
                var UserAddress = db.tblAddress.Single((o => o.ID.Equals(User.AddressID)));

                MyProfileView.UserName  = User.UserName;
                MyProfileView.FirstName = User.FirstName;
                MyProfileView.LastName  = User.LastName;
                MyProfileView.Email     = User.Email;
                MyProfileView.Gender    = User.Gender;
                MyProfileView.BirthDate = User.BirthDate;

                MyProfileView.Country         = UserAddress.Country;
                MyProfileView.City            = UserAddress.City;
                MyProfileView.Region          = UserAddress.Region;
                MyProfileView.ZipCode         = UserAddress.ZipCode;
                MyProfileView.Street          = UserAddress.Street;
                MyProfileView.Number          = UserAddress.Number;
                MyProfileView.ApartmentNumber = UserAddress.ApartmentNumber;
            }

            return(MyProfileView);
        }
コード例 #3
0
 public MySettings()
 {
     vm             = new MySettingsViewModel();
     Title          = "Settings";
     BindingContext = vm;
     InitializeComponent();
 }
コード例 #4
0
        public async Task <PartialViewResult> MySettingsModal()
        {
            var output = await _profileAppService.GetCurrentUserProfileForEdit();

            var viewModel = new MySettingsViewModel(output);

            return(PartialView("_MySettingsModal", viewModel));
        }
コード例 #5
0
        public async Task <ActionResult> MySettings()
        {
            MySettingsViewModel model = new MySettingsViewModel();

            model.LoggedInUser = await userService.GetCurrentUser();

            List <String> destNames = new List <String>()
            {
                settingsActionDest
            };

            model.FullNavList = CreateAccountControllerNavList(destNames);

            return(View(model));
        }
コード例 #6
0
 public ActionResult MySettingsIndex(MySettingsViewModel tUD)
 {
     if (ModelState.IsValid)
     {
         UserManager US = new UserManager();
         if (US.SaveProfile(tUD) == 1)
         {
             ModelState.AddModelError("", "Confirm password dont mach");
         }
         else
         {
             tUD.SaveMessage = "Changes were saved";
         }
     }
     return(View(tUD));
 }
コード例 #7
0
        public async Task <PartialViewResult> MySettingsModal()
        {
            var output = await _profileAppService.GetCurrentUserProfileForEdit();

            var timezoneItems = await _timingAppService.GetTimezoneComboboxItems(new GetTimezoneComboboxItemsInput
            {
                DefaultTimezoneScope = SettingScopes.User,
                SelectedTimezoneId   = output.Timezone
            });

            var viewModel = new MySettingsViewModel(output)
            {
                TimezoneItems = timezoneItems
            };

            return(PartialView("_MySettingsModal", viewModel));
        }
コード例 #8
0
        public async Task <PartialViewResult> MySettingsModal()
        {
            var output = await _profileAppService.GetCurrentUserProfileForEdit();

            var timezoneItems = await _timingAppService.GetTimezoneComboboxItems(new GetTimezoneComboboxItemsInput
            {
                DefaultTimezoneScope = SettingScopes.User,
                SelectedTimezoneId   = output.Timezone
            });


            var viewModel = new MySettingsViewModel(output)
            {
                TimezoneItems          = timezoneItems,
                SmsVerificationEnabled = await SettingManager.GetSettingValueAsync <bool>(AppSettings.UserManagement.SmsVerificationEnabled)
            };

            return(PartialView("_MySettingsModal", viewModel));
        }
コード例 #9
0
        public async Task <ActionResult> MySettings(MySettingsViewModel model)
        {
            List <String> destNames = new List <String>()
            {
                settingsActionDest
            };

            if (String.IsNullOrEmpty(model.PaginationPreference) == false)
            {
                int pagination = 0;

                Int32.TryParse(model.PaginationPreference, out pagination);

                if (model.PaginationPreference.CompareTo("0") != 0 && pagination == 0)
                {
                    ModelState.AddModelError(String.Empty, "Invalid pagination value selected.");

                    model.LoggedInUser = await userService.GetCurrentUser();

                    model.FullNavList = CreateAccountControllerNavList(destNames);

                    return(View(model));
                }
                else
                {
                    model.LoggedInUser.PaginationPreference = pagination;
                }
            }

            if (String.IsNullOrEmpty(model.AppIDs) == false)
            {
                model.SuccessfulItemsAdded = await userService.AddWishlistItems(model.AppIDs);
            }

            await userService.EditAppUserSettings(model.LoggedInUser);

            model.LoggedInUser = await userService.GetCurrentUser();

            model.FullNavList = CreateAccountControllerNavList(destNames);

            return(View(model));
        }
コード例 #10
0
 public MySettingsPage()
 {
     InitializeComponent();
     this.BindingContext        = _viewModel = new MySettingsViewModel();
     _viewModel.SettingsLoaded += _viewModel_SettingsLoaded;
 }