コード例 #1
0
        /// <summary>
        ///     Store user settings in a local file.
        /// </summary>
        /// <param name="settings">Existing settings.</param>
        /// <returns></returns>
        public bool StoreUserSettings(AccountSettingsViewModel settings)
        {
            bool isSuccessful;

            try
            {
                var serializer = new XmlSerializer(typeof(AccountSettingsViewModel));
                using (var writer = new StreamWriter(Path.Combine(AppPath, AppSetup.SettingsFileName)))
                {
                    serializer.Serialize(writer, settings);
                }
                isSuccessful = true;

                LoggingViewModel.Instance.Logger.Write(string.Concat("StoreUserSettings:Success ",
                                                                     AccountSettingsViewModel.Instance.ServerUrl,
                                                                     Environment.NewLine, AccountSettingsViewModel.Instance.IsInternal, Environment.NewLine,
                                                                     AccountSettingsViewModel.Instance.ApiPrefix));
            }
            catch (Exception exception)
            {
                LoggingViewModel.Instance.Logger.Write(string.Concat("StoreUserSettings:Error ", exception.Message,
                                                                     Environment.NewLine,
                                                                     exception.StackTrace));

                isSuccessful = false;
            }

            return(isSuccessful);
        }
コード例 #2
0
        /// <summary>
        ///     Deserializes settings stored in a local file.
        /// </summary>
        /// <returns></returns>
        public AccountSettingsViewModel GetUserSettings()
        {
            var settings = new AccountSettingsViewModel();

            try
            {
                var serializer = new XmlSerializer(typeof(AccountSettingsViewModel));
                if (File.Exists(Path.Combine(AppPath, AppSetup.SettingsFileName)))
                {
                    using (var reader = new StreamReader(Path.Combine(AppPath, AppSetup.SettingsFileName)))
                    {
                        settings = (AccountSettingsViewModel)serializer.Deserialize(reader);
                    }
                }

                LoggingViewModel.Instance.Logger.Write("GetUserSettings:OK");
            }
            catch (Exception exception)
            {
                LoggingViewModel.Instance.Logger.Write(string.Concat("StoreUserSettings:Error ", exception.Message,
                                                                     Environment.NewLine,
                                                                     exception.StackTrace));
            }

            return(settings);
        }
コード例 #3
0
ファイル: CaptainController.cs プロジェクト: G00ryl/Pitchball
        public async Task <IActionResult> UpdatePasswordAsync(AccountSettingsViewModel viewModel)
        {
            var id = int.Parse(HttpContext.Session.GetString("Id"));

            if (!ModelState.IsValid)
            {
                viewModel.Account = await _accountService.GetAsync(id);

                return(View("CaptainPanelEdit", viewModel));
            }

            try
            {
                await _accountService.ChangePasswordAsync(id, viewModel.Command);

                return(RedirectToAction("Profile"));
            }
            catch (Exception)
            {
                ViewBag.ShowError    = true;
                ViewBag.ErrorMessage = "Coś poszło nie tak.";

                return(RedirectToAction("EditProfile"));
            }
        }
コード例 #4
0
ファイル: CaptainController.cs プロジェクト: G00ryl/Pitchball
        public async Task <IActionResult> AddOrUpdatePictureAsync(AccountSettingsViewModel viewModel, IFormFile image = null)
        {
            var id = int.Parse(HttpContext.Session.GetString("Id"));

            if (!ModelState.IsValid || image == null)
            {
                viewModel.Account = await _accountService.GetAsync(id);

                return(View("CaptainPanelEdit", viewModel));
            }

            try
            {
                if (await _imageService.ExistsForParentAsync(id) == false)
                {
                    await _imageService.AddAsync(id, image);
                }
                else
                {
                    await _imageService.UpdateAsync(id, image);
                }

                return(RedirectToAction("Profile"));
            }
            catch (Exception)
            {
                ViewBag.ShowError    = true;
                ViewBag.ErrorMessage = "Coś poszło nie tak.";

                return(RedirectToAction("EditProfile"));
            }
        }
コード例 #5
0
        public ActionResult UpdateWallet(AccountSettingsViewModel vm)
        {
            vm.StatusMessage = "inputForm";

            if (_user == null)
            {
                _user = _userManager.GetUserAsync(User).Result;
            }

            if (_user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
            }
            vm.UserImage = _user.Id + ".jpg";
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError(string.Empty, "Some error occured.");
                return(View(vm));
            }
            if (!string.IsNullOrEmpty(vm.WalletAddress) && vm.WalletAddress.StartsWith("0x") && vm.WalletAddress.Length == 42)
            {
                ModelState.AddModelError(string.Empty, "Wallet address updated");
                _user.WalletAddress = vm.WalletAddress;
                _db.SaveChanges();
            }
            else
            {
                ModelState.AddModelError(string.Empty, "Wallet address is not valid");
                vm.WalletAddress = null;
            }
            return(RedirectToAction(nameof(AccountSettings)));
        }
コード例 #6
0
        public ActionResult Settings()
        {
            DataSet accountSettingsResultSet         = userRepository.GetAccountSettingsData(SessionUserId, null);
            AccountSettingsViewModel accountSettings = accountSettingsResultSet.Tables[0].AsEnumerable().Select(results => new AccountSettingsViewModel
            {
                UserName        = results.Field <string>("UserName"),
                FirstName       = results.Field <string>("FirstName"),
                LastName        = results.Field <string>("LastName"),
                MiddleName      = results.Field <string>("MiddleName"),
                PetName         = results.Field <string>("PetName"),
                Phone           = results.Field <string>("Phone"),
                Mobile          = results.Field <string>("Mobile"),
                Gender          = results.Field <string>("Gender"),
                CompanyId       = results.Field <int>("CompanyId"),
                CompanyName     = results.Field <string>("CompanyName"),
                AllowInvites    = results.Field <bool>("AllowInvites"),
                CurrentPassword = results.Field <string>("CurrentPassword"),
                DateOfBirth     = results.Field <DateTime?>("DateOfBirth").GetDefaultValueIfNull <string>(),
                Email           = results.Field <string>("Email"),
                AddressLine1    = results.Field <string>("AddressLine1"),
                AddressLine2    = results.Field <string>("AddressLine2"),
                City            = results.Field <string>("City"),
                PinCode         = results.Field <string>("PinCode"),
                Country         = results.Field <string>("Country"),
            }).FirstOrDefault();

            return(View("Settings", accountSettings));
        }
コード例 #7
0
        public IActionResult Settings(bool shared)
        {
            var accountId = HttpContext.Session.Get <long>(SessionHelper.SessionKeyAccountId);

            if (accountId == default)
            {
                return(RedirectToAction("Login", "Account", new { id = LoginHelper.BudgetApp }));
            }

            var hasSharedAccount = AccountHelper.HasSharedAccount(accountId);

            if (hasSharedAccount && shared)
            {
                var sharedAccountId        = AccountHelper.GetSharedAccountId(accountId);
                var categorySettings       = SettingsHelper.GetCategorySettings(sharedAccountId);
                var expenseSummarySettings = SettingsHelper.GetExpenseSummarySettings(sharedAccountId);
                var model = new AccountSettingsViewModel(categorySettings, expenseSummarySettings, true, hasSharedAccount);
                model.SetBaseViewModel(accountId);
                return(View(SettingsHelper.GetAccountControllerViewPath("BudgetAccountSettings"), model));
            }
            else
            {
                var categorySettings       = SettingsHelper.GetCategorySettings(accountId);
                var expenseSummarySettings = SettingsHelper.GetExpenseSummarySettings(accountId);
                var model = new AccountSettingsViewModel(categorySettings, expenseSummarySettings, false, hasSharedAccount);
                model.SetBaseViewModel(accountId);
                return(View(SettingsHelper.GetAccountControllerViewPath("BudgetAccountSettings"), model));
            }
        }
コード例 #8
0
        //this action is called when user attempts to save data
        //therefore it receives AccountSettingsViewModel object
        public async Task <ActionResult> AccountSettings(AccountSettingsViewModel model)
        {
            ViewBag.ReturnUrl = Url.Action("AccountSettings");

            if (ModelState.IsValid)
            {
                var user = UserManager.FindById(User.Identity.GetUserId());
                user.Email    = model.Email;
                user.UserName = model.UserName;
                user.Mobile   = model.Mobile;

                IdentityResult result = await UserManager.UpdateAsync(user);

                if (result.Succeeded)
                {
                    //if everything is validated and saved successfully,
                    //we will be redirected to AccountSettings GET action
                    //where success message will be displayed, but form will be hidden
                    return(RedirectToAction("AccountSettings", new { savedSuccesfully = true }));
                }
            }

            // If we got this far, something failed, redisplay form
            ViewBag.showForm = true;
            return(View(model));
        }
コード例 #9
0
        public ActionResult ChangeUserSettings([Bind(Include = "ID,Email,Telefon")] AccountSettingsViewModel kullanici)
        {
            bool         emailVarMi   = db.Kullanicilar.Any(x => x.Email == kullanici.Email && x.ID != kullanici.ID);
            bool         telefonVarMi = db.Kullanicilar.Any(x => x.Telefon == kullanici.Telefon && x.ID != kullanici.ID);
            Kullanicilar bilgileriDegisecekOlanKullanici = db.Kullanicilar.Find(kullanici.ID);

            if (ModelState.IsValid)
            {
                if (emailVarMi || telefonVarMi)
                {
                    string olanlar = string.Format($"{(emailVarMi ? "Email " : "")} {(telefonVarMi ? "Telefon " : "")}");

                    // return Json(kullanicilar,JsonRequestBehavior.AllowGet);
                    bilgileriDegisecekOlanKullanici.ErrorMessage += olanlar + " sistemde kayıtlı.";
                    bilgileriDegisecekOlanKullanici.Sifre         = null;
                    return(PartialView(@"~\Views\Depremler\AccountPartial.cshtml", bilgileriDegisecekOlanKullanici));
                }
                bilgileriDegisecekOlanKullanici.Email     = kullanici.Email;
                bilgileriDegisecekOlanKullanici.Telefon   = kullanici.Telefon;
                bilgileriDegisecekOlanKullanici.SifreOnay = bilgileriDegisecekOlanKullanici.Sifre;
                db.SaveChanges();
                return(Json(new { url = Url.Action("Index", "Depremler") }));
            }
            return(PartialView(@"~\Views\Depremler\AccountPartial.cshtml", bilgileriDegisecekOlanKullanici));
        }
コード例 #10
0
        public ActionResult Settings(AccountSettingsViewModel data, string updateBtn)
        {
            Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1.
            Response.AppendHeader("Pragma", "no-cache");                                   // HTTP 1.0.
            Response.AppendHeader("Expires", "0");                                         // Proxies.
            data.HintQuestion = dbc.GetSecurityQuestions();

            if (ModelState.IsValid)
            {
                var path = "";

                if (data.PhotoFile != null)

                {
                    if (data.PhotoFile.ContentLength > 0)

                    {
                        //for checking uploaded file is image or not

                        if (Path.GetExtension(data.PhotoFile.FileName).ToLower() == ".jpg"

                            || Path.GetExtension(data.PhotoFile.FileName).ToLower() == ".png"

                            || Path.GetExtension(data.PhotoFile.FileName).ToLower() == ".gif"

                            || Path.GetExtension(data.PhotoFile.FileName).ToLower() == ".jpeg")

                        {
                            //path = "C:/inetpub/wwwroot/NotifyHealth/Content/img/Users/";

                            path = Server.MapPath("../Content/img/Users/");
                            data.PhotoFile.SaveAs(Path.Combine(path, data.PhotoFile.FileName));

                            //data.PhotoPath = "../Content/img/Users/" + data.PhotoFile.FileName;
                            data.PhotoPath = data.PhotoFile.FileName;
                        }
                    }
                }

                string UpdateMessage = dbc.ManageAccount(Convert.ToInt32(Session["UserSessionId"]), Session["UserSessionGUID"].ToString(), data);

                if (UpdateMessage != "Account Settings updated successfully!")
                {
                    ViewBag.Message           = UpdateMessage;
                    TempData["UpdateMessage"] = UpdateMessage;
                    return(View(data));
                }
                else
                {
                    if (data.PhotoPath != null)
                    {
                        Session["Photo"] = "../Content/img/Users/" + data.PhotoPath;
                    }
                    TempData["UpdateMessage"] = UpdateMessage;
                    return(RedirectToAction("Index", "Home"));
                }
            }

            return(View(data));
        }
コード例 #11
0
        public ActionResult AccountSettings(bool?savedSuccesfully)
        {
            //fist, we need to find the logged in user data
            var user = UserManager.FindById(User.Identity.GetUserId());

            ViewBag.ErrorMessage = "";

            //then create AccountSettingsViewModel with data filled in.
            //notice that we user user object initialized before
            AccountSettingsViewModel model = new AccountSettingsViewModel {
                Email = user.Email, UserName = user.UserName, Mobile = user.Mobile
            };


            //the section below defines what happens on the form
            ViewBag.showForm = true;
            if (savedSuccesfully != null && savedSuccesfully == true)
            {
                ViewBag.showForm      = false;
                ViewBag.StatusMessage = "Data saved sucessfully";
            }
            else if (savedSuccesfully != null && savedSuccesfully == false)
            {
                ViewBag.showForm     = false;
                ViewBag.ErrorMessage = "Something went wrong!";
            }

            return(View(model));
        }
コード例 #12
0
        // GET: /Account/AccountSettings
        public ActionResult AccountSettings(bool?savedSuccesfully)
        {
            var user = UserManager.FindById(User.Identity.GetUserId());

            ViewBag.ErrorMessage = "";


            AccountSettingsViewModel model = new AccountSettingsViewModel {
                Email = user.Email, FullName = user.FullName, Address = user.Address, Phone = user.Phone
            };


            //the section below defines what happens on the form
            ViewBag.showForm = true;
            if (savedSuccesfully != null && savedSuccesfully == true)
            {
                ViewBag.showForm      = false;
                ViewBag.StatusMessage = "Data saved sucessfully";
            }
            else if (savedSuccesfully != null && savedSuccesfully == false)
            {
                ViewBag.showForm     = false;
                ViewBag.ErrorMessage = "Something went wrong!";
            }

            return(View(model));
        }
コード例 #13
0
        public ActionResult UpdateSettings(AccountSettingsViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                // Create an Auto Mapper map between the setting profile entity and the view model.
                Mapper.CreateMap <AccountSettingsViewModel, SettingProfile>();

                // Convert the currently logged-in account id to an integer.
                viewModel.AccountId = Conversion.StringToInt32(User.Identity.Name);

                // Populate a setting profile with automapper and pass it back to the service layer for update.
                SettingProfile settingProfile = Mapper.Map <AccountSettingsViewModel, SettingProfile>(viewModel);
                var            result         = this.doctrineShipsServices.UpdateSettingProfile(settingProfile);

                // If the result is false, something did not validate in the service layer.
                if (result != false)
                {
                    TempData["Status"] = "The settings were successfully updated.";
                }
                else
                {
                    TempData["Status"] = "Error: The settings were not updated, a validation error occured.";
                }

                return(RedirectToAction("Settings"));
            }
            else
            {
                return(View("~/Views/Account/Settings.cshtml", viewModel));
            }
        }
コード例 #14
0
        public async Task <IActionResult> Update(AccountSettingsViewModel model)
        {
            // Instantiates the current user
            var user = await GetCurrentUserAsync();

            // Adds the updated properties
            user.LastName      = model.LastName;
            user.PhoneNumber   = model.PhoneNumber;
            user.StreetAddress = model.Address;

            if (ModelState.IsValid)
            {
                try
                {
                    // Updates the user in the database
                    _context.Update(user);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (user == null)
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                // Adds a message on successful profile update
                TempData["SuccessMessage"] = "Your account has been updated";
            }
            return(RedirectToAction("Edit"));
        }
コード例 #15
0
 /// <summary>
 /// Provides a deterministic way to create the ViewModelPropertyName property.
 /// </summary>
 public static void CreateAccountSettings()
 {
     if (_accountSettings == null)
     {
         _accountSettings = new AccountSettingsViewModel();
     }
 }
コード例 #16
0
        public GetAccountUnsubscribeViewByAccountIdResponse GetAccountUnsubscribeView(GetAccountUnsubscribeViewByAccountIdRequest request)
        {
            GetAccountUnsubscribeViewByAccountIdResponse response = new GetAccountUnsubscribeViewByAccountIdResponse();
            AccountSettings          accountUnsubcribeViewMap     = accountUnsubscribeViewRepository.GetAccountUnsubcribeViewByAccountId(request.AccountID);
            AccountSettingsViewModel accountUnsubcribeView        = Mapper.Map <AccountSettings, AccountSettingsViewModel>(accountUnsubcribeViewMap);

            response.accountUnsubscribeViewMap = accountUnsubcribeView;
            return(response);
        }
コード例 #17
0
        public IActionResult UpdateSetting([FromBody] AccountSettingsViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            return(Ok(_accountsService.UpdateSettings(model)));
        }
コード例 #18
0
 public SettingsRootViewModel(
     GameSettingsViewModel gameSettingsVM,
     AccountSettingsViewModel accountSettingsVM,
     LauncherSettingsViewModel launcherSettingsVM)
 {
     GameSettingsVM     = gameSettingsVM;
     AccountSettingsVM  = accountSettingsVM;
     LauncherSettingsVM = launcherSettingsVM;
 }
コード例 #19
0
        public async Task <IActionResult> AccountSettings(AccountSettingsViewModel vm)
        {
            vm.StatusMessage = "inputForm";

            if (_user == null)
            {
                _user = _userManager.GetUserAsync(User).Result;
            }

            if (_user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
            }
            vm.UserImage = _user.Id + ".jpg";
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError(string.Empty, "Some error occured.");
                return(View(vm));
            }

            if (string.IsNullOrEmpty(vm.OldPassword))
            {
                ModelState.AddModelError(string.Empty, "Current password cannot be null.");
                return(View(vm));
            }
            if (string.IsNullOrEmpty(vm.NewPassword))
            {
                ModelState.AddModelError(string.Empty, "New Password cannot be null.");
                return(View(vm));
            }
            if (string.IsNullOrEmpty(vm.ConfirmPassword))
            {
                ModelState.AddModelError(string.Empty, "Confirm Password cannot be null.");
                return(View(vm));
            }
            if (!string.IsNullOrEmpty(vm.NewPassword) && !string.IsNullOrEmpty(vm.NewPassword) && !string.IsNullOrEmpty(vm.ConfirmPassword))
            {
                var changePasswordResult = await _userManager.ChangePasswordAsync(_user, vm.OldPassword, vm.NewPassword);

                if (!changePasswordResult.Succeeded)
                {
                    AddErrors(changePasswordResult);
                    return(View(vm));
                }

                await _signInManager.SignInAsync(_user, isPersistent : false);

                _logger.LogInformation("User changed their password successfully.");
                //StatusMessage = "Your password has been changed.";
                ModelState.AddModelError(string.Empty, "You have changed your password successfully.");
                return(View(vm));
            }

            return(RedirectToAction(nameof(AccountSettings)));
        }
コード例 #20
0
        public async Task <IActionResult> Update(AccountSettingsViewModel model, IFormFile Photo)
        {
            User   user = new User();
            string ph   = (await profileManager.GetUserAsync(User.Identity.Name)).UserPhoto;

            if (ph != null)
            {
                model.Photo = ph;
            }

            if (Photo == null || Photo.Length == 0)
            {
                user.Username  = User.Identity.Name;
                user.FirstName = model.FirstName;
                user.LastName  = model.LastName;
                user.Email     = model.Email;
                user.UserPhoto = model.Photo;
                await profileManager.UserUpdateAsync(user);

                return(RedirectToAction("AccountSettings", "Profile"));
            }

            if (Photo.ContentType.IndexOf("image", StringComparison.OrdinalIgnoreCase) < 0)
            {
                user.Username  = User.Identity.Name;
                user.FirstName = model.FirstName;
                user.LastName  = model.LastName;
                user.Email     = model.Email;
                user.UserPhoto = model.Photo;
                await profileManager.UserUpdateAsync(user);

                return(RedirectToAction("AccountSettings", "Profile"));
            }

            string imageFolder  = "UsersImages";
            string fileName     = User.Identity.Name + ".jpg";
            string pathRoot     = environment.WebRootPath;
            string targetFolder = pathRoot + "\\images\\" + imageFolder + "\\";
            string targetFile   = targetFolder + fileName;

            using (var stream = new FileStream(targetFile, FileMode.Create))
            {
                Photo.CopyTo(stream);
            }

            user.Username  = User.Identity.Name;
            user.FirstName = model.FirstName;
            user.LastName  = model.LastName;
            user.Email     = model.Email;
            user.UserPhoto = Path.GetRelativePath(pathRoot, targetFile);
            await profileManager.UserUpdateAsync(user);

            return(RedirectToAction("AccountSettings", "Profile"));
        }
コード例 #21
0
        public ActionResult Settings()
        {
            var userService = new Services.UserService();
            var userId      = userService.GetUserIdByName(User.Identity.Name);
            var model       = new AccountSettingsViewModel();

            model = userService.GetUserSettingsById(userId);

            ViewBag.UserName = User.Identity.Name;
            return(View(model));
        }
コード例 #22
0
        //[HttpPost]
        public ActionResult Settings()
        {
            var user    = userService.FindById(User.Identity.GetUserId <int>());
            var account = new AccountSettingsViewModel
            {
                Email    = user.Email,
                UserName = user.UserName,
            };

            return(View(account));
        }
コード例 #23
0
        public AccountSettingsViewModel GetUserSettingsById(string userId)
        {
            var user      = new AccountSettingsViewModel();
            var db        = new Database();
            var userQuery = db.AspNetUsers.SingleOrDefault(x => x.Id == userId);

            if (userQuery != null)
            {
                user.FullName = userQuery.FullName;
            }
            return(user);
        }
コード例 #24
0
        //public DataAccessRights dar = new DataAccessRights();
        //public List<Tenant> ltn = new List<Tenant>();
        //public List<Users> usr = new List<Users>();

        public bool IsValid(string email, string password)
        {
            bool retval = false;

            try
            {
                dbc.GetSession(email, password, "LogonActivateAccount");
            }
            catch (Exception ex)
            {
                var LoginError = ex.Message;
            }

            SessionId   = dbc.SessionId;
            SessionGUID = dbc.SessionGUID;
            strReturnValidationError   = dbc.ReturnValidationError;
            strReturnValidationMessage = dbc.ReturnValidationMessage;

            try
            {
                dbc.CheckSession(Convert.ToInt32(SessionId), SessionGUID, "LogonActivateAccount");
            }
            catch (Exception ex)
            {
                var LoginError = ex.Message;
            }
            Portal         = dbc.Portal;
            Logo           = dbc.Logo;
            OrganizationID = dbc.OrganizationID;
            Organization   = dbc.Organization;

            if (strReturnValidationError == "0")
            {
                //load pages for menu

                accset = dbc.GetAccountDetails(Convert.ToInt32(dbc.SessionId), SessionGUID);
                //ar = dbc.GetContentAccessRights(Convert.ToInt32(dbc.SessionId), accset.UserLogonID.ToString());
                //dar = dbc.GetDataAccessRights(Convert.ToInt32(SessionId));
                //ltn = dbc.GetTenant(Convert.ToInt32(SessionId));

                //if (accset.UserRole == 1 || accset.UserRole == 2)
                //{
                //    usr = dbc.GetUserDropdown(Convert.ToInt32(SessionId), Convert.ToInt32(ltn.First().TenantID), accset.CompanyId, accset.UserLogonID);
                //}
                //if (ltn.Count() == 1) { TenantId = ltn.FirstOrDefault().TenantID; }

                retval = true;
            }

            return(retval);
        }
コード例 #25
0
        public AccountSettingsViewModel UpdateSettings(AccountSettingsViewModel accConfig)
        {
            var configuration = _uow.AccountCofigurationRepository.FindSingle(accConfig.Id);

            if (configuration == null)
            {
                throw new CustomException(StatusCodes.Status501NotImplemented, ExceptionsMessages.CantUpdateAccountConfiguration);
            }

            configuration.IsAdminMode = accConfig.IsAdminMode;
            var result = _uow.AccountCofigurationRepository.Update(configuration);

            return(_mapper.Map <AccountSettingsViewModel>(result));
        }
コード例 #26
0
        // POST /Manage/UpdateAccountSettings
        public ActionResult UpdateAccountSettings(AccountSettingsViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var user = db.Users.Find(User.Identity.GetUserId());

                user.FirstName = viewModel.FirstName;
                user.LastName  = viewModel.LastName;

                db.SaveChanges();
            }

            return(RedirectToAction(nameof(AccountSettings)));
        }
コード例 #27
0
        public ActionResult AccountSettings()
        {
            Employee emp = (Employee)Session["user"];
            AccountSettingsViewModel settings = new AccountSettingsViewModel()
            {
                employeeID        = emp.employeeID,
                employeeFirstName = emp.employeeFirstName,
                employeeLastName  = emp.employeeLastName,
                employeeEmail     = emp.employeeEmail
            };


            return(View(settings));
        }
コード例 #28
0
        //private readonly UserInformationContext context = new UserInformationContext();

        public AccountSettings()
        {
            var r = new AccountSettingsViewModel()
            {
                Email            = "TODO",
                Password         = "",
                SecurityQuestion = "",
                SecurityAnswer   = ""
            };

            InitializeComponent();

            // SaveChanges.Click += new RoutedEventHandler(SaveChanges_Click);
        }
コード例 #29
0
        public async Task <ActionResult> Account()
        {
            UserBO user = await UserManager.FindByIdAsync(CurrentUserId);

            AccountSettingsViewModel model = new AccountSettingsViewModel
            {
                UserId     = user.Id,
                Firstname  = user.FirstName,
                Lastname   = user.LastName,
                Middlename = user.MiddleName,
                Email      = user.Email
            };

            return(View(model));
        }
コード例 #30
0
        public IActionResult AccountSettings()
        {
            var userId  = User.FindFirst(ClaimTypes.NameIdentifier).Value;
            var Account = _userManager.Users.FirstOrDefault(u => u.Id == userId);

            var model = new AccountSettingsViewModel
            {
                Id       = userId,
                Email    = Account.Email,
                Phone    = Account.PhoneNumber,
                UserName = Account.UserName
            };

            return(View(model));
        }