Ejemplo n.º 1
0
        public ActionResult ModifyInfo(AccountInfoViewModel model)
        {
            ResponseModel response = new ResponseModel();
            if (!ModelState.IsValid)
            {
                foreach (var item in ModelState)
                {
                    if (item.Value.Errors.Count > 0)
                    {
                        response.Success = false;
                        response.Msg = item.Value.Errors.FirstOrDefault().ErrorMessage;
                    }
                }
            }
            else
            {
                Account account = _accountService.GetById(model.Id);
                account.UpdateTime = DateTime.Now;
                account.Name = model.Name;
                account.PhoneNumber = model.PhoneNumber;
                account.Email = model.Email;
                _accountService.Update(account);
                _unitOfWork.Commit();
                response.Success = true;
                response.Msg = "已成功修改个人信息";
                response.RedirectUrl = Url.Action("Setting", "Account");
                return Json(response, JsonRequestBehavior.AllowGet);

            }
            return Json(response);

        }
Ejemplo n.º 2
0
        public ActionResult ChangePersonalDetail(AccountInfoViewModel model)
        {
            if (ModelState.IsValid)
            {
                SuccessAndMsg changeUserInfoResult = accountDAO.ChangePersonalDetail(model);

                if (changeUserInfoResult.IsSuccess)
                {
                    // đổi thông tin tài khoản thành công
                    ViewBag.UpdateInfoMsg = changeUserInfoResult.Message;
                }
                else
                {
                    // đổi thông tin tài khoản thất bại
                    ModelState.AddModelError("", changeUserInfoResult.Message);
                }
            }
            else
            {
                // nhập thiếu thông tin hoặc thông tin không hợp lệ
                ModelState.AddModelError("", ActionMessage.MissingOrInvalidInfo);
            }

            return(View(model));
        }
        public ActionResult Index()
        {
            string username = Session.GetCurrentUserInfo("Username");
            AccountInfoViewModel viewModel = accountService.ViewMyAccount(username);

            return(View("~/Views/Admin/admin_info.cshtml", viewModel));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> AccountInformation(AccountInfoViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            ViewData["UserName"]  = model.Username;

            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByNameAsync(model.Username);

                user.FirstName   = model.FirstName;
                user.LastName    = model.LastName;
                user.PhoneNumber = model.PhoneNumber;
                user.Email       = model.Email;
                if (model.ImageName != null)
                {
                    _logger.LogProfileImageHistory(user.Id, model.ImageName);
                    user.ProfileImageName = model.ImageName;
                }
                var result = await _userManager.UpdateAsync(user);

                if (result.Succeeded)
                {
                    return(RedirectToAction("AccountInformation", new { userName = model.Username, returnUrl = returnUrl }));
                }
                ModelState.AddModelError(String.Empty, "مشکل در بروزرسانی اطلاعات کاربر.");
                return(View(model));
            }
            return(View(model));
        }
Ejemplo n.º 5
0
        public ActionResult ChangePersonalDetail(AccountInfoViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = db.Users.FirstOrDefault(u => u.Username == model.Username);

                if (user != null)
                {
                    user.Username = model.Username;
                    user.Address  = model.Address;
                    user.Email    = model.Email;
                    user.Name     = model.Name;
                    user.Phone    = model.Phone;

                    db.SaveChanges();
                    ViewBag.UpdateInfoMsg = "Cập nhật thông tin thành công";
                }
                else
                {
                    ModelState.AddModelError("", "Cập nhật thông tin thất bại");
                }
            }

            return(View(model));
        }
Ejemplo n.º 6
0
        public ActionResult UploadFiles(int projectId)
        {
            BaseResponse         response       = null;
            AccountInfoViewModel accountDetails = new AccountInfoViewModel();

            if (Request.Files.Count > 0)
            {
                try
                {
                    HttpFileCollectionBase files = Request.Files;

                    for (int i = 0; i < files.Count; i++)
                    {
                        HttpPostedFileBase file = files[i];

                        BinaryReader b       = new BinaryReader(file.InputStream);
                        byte[]       binData = b.ReadBytes((int)file.InputStream.Length);

                        string result = System.Text.Encoding.UTF8.GetString(binData);
                        response = _accountExecutor.UploadAccountsInfo(result, 1, projectId);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            if (response != null && !response.HasError)
            {
                return(RedirectToAction("GetAccountsDetails", new { projectId = projectId }));
            }

            throw new Exception();
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Profile()
        {
            var profileData = await GetAccountInfo();

            AccountInfoViewModel viewModel = ConvertToViewModel(profileData);

            return(View(viewModel));
        }
Ejemplo n.º 8
0
        public ActionResult ProvideDataToBuyer(AccountInfoViewModel model)
        {
            if (ModelState.IsValid)
            {
                var accountInfo = Mapper.Map <AccountInfoViewModel, AccountInfo>(model);
                var buyerOrder  = _orderService.GetOrder(model.SteamLogin, model.ModeratorId, model.SellerId, model.BuyerId, i => i.CurrentStatus,
                                                         i => i.StatusLogs, i => i.AccountInfos, i => i.Seller.ApplicationUser, i => i.Buyer.ApplicationUser);
                if (buyerOrder?.CurrentStatus != null)
                {
                    if (buyerOrder.CurrentStatus.Value == OrderStatuses.MidddlemanChecking)
                    {
                        buyerOrder.StatusLogs.AddLast(new StatusLog()
                        {
                            OldStatus = buyerOrder.CurrentStatus,
                            NewStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.BuyerConfirming),
                            TimeStamp = DateTime.Now
                        });
                        buyerOrder.CurrentStatus = _orderStatusService.GetOrderStatusByValue(OrderStatuses.BuyerConfirming);


                        buyerOrder.BuyerChecked  = false;
                        buyerOrder.SellerChecked = false;


                        buyerOrder.AccountInfos.Add(accountInfo);
                        _accountInfoService.CreateAccountInfo(accountInfo);

                        if (buyerOrder.JobId != null)
                        {
                            BackgroundJob.Delete(buyerOrder.JobId);
                            buyerOrder.JobId = null;
                        }
                        _orderService.SaveOrder();

                        buyerOrder.JobId = MarketHangfire.SetConfirmOrderJob(buyerOrder.Id, TimeSpan.FromDays(2));


                        if (Request.Url != null)
                        {
                            MarketHangfire.SetSendEmailChangeStatus(buyerOrder.Id,
                                                                    buyerOrder.Seller.ApplicationUser.Email, buyerOrder.CurrentStatus.DuringName,
                                                                    Url.Action("SellDetails", "Order", new { id = buyerOrder.Id },
                                                                               protocol: Request.Url.Scheme));

                            MarketHangfire.SetSendEmailAccountData(accountInfo.Login, accountInfo.Password, accountInfo.Email, accountInfo.EmailPassword,
                                                                   accountInfo.AdditionalInformation, buyerOrder.Buyer.ApplicationUser.Email);
                        }

                        _orderService.SaveOrder();

                        return(RedirectToAction("ProvideDataToBuyer", new { orderId = buyerOrder.Id }));
                    }
                }
            }
            return(HttpNotFound());
        }
Ejemplo n.º 9
0
        public async Task <IActionResult> UpdateInfo(AccountInfoViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                await EzTask.Account.UpdateAccount(ConvertToModel(viewModel));

                await EzTask.Skill.SaveAccountSkill(viewModel.Skills, Context.CurrentAccount.AccountId);
            }
            return(View("Profile", viewModel));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Lấy ra thông tin của người dùng
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public GetAccountInfoResultType GetAccountInfo(string username)
        {
            User user = db.Users.FirstOrDefault(u => u.Active == true && u.Username == username);

            if (user != null)
            {
                AccountInfoViewModel accountInfo = new AccountInfoViewModel(user);
                return(new GetAccountInfoResultType(true, GetAccountInfoResult.GetAccountInfoSuccessful, accountInfo));
            }

            return(new GetAccountInfoResultType(false, GetAccountInfoResult.GetAccountInfoFailed));
        }
Ejemplo n.º 11
0
        public ActionResult CompleteAccount(int timeLogId, int accountId, int statusId, string comments, int projectId)
        {
            AccountInfoViewModel accountDetails = new AccountInfoViewModel();
            BaseResponse         response       = _accountExecutor.CompleteAccount(1, accountId, timeLogId, statusId, comments);

            if (response != null && !response.HasError)
            {
                return(RedirectToAction("GetAccountsDetails", new { projectId = projectId }));
            }

            throw new Exception();
        }
Ejemplo n.º 12
0
        public ActionResult ModifyInfo()
        {

            Account Information = _accountService.GetById(LoginAccount.Id);
            AccountInfoViewModel viewModel = new AccountInfoViewModel();
            viewModel.Amount = Information.Amount;
            viewModel.Name = Information.Name;
            viewModel.PhoneNumber = Information.PhoneNumber;
            viewModel.Email = Information.Email;
            viewModel.Id = Information.Id;
            return View(viewModel);
        }
Ejemplo n.º 13
0
        public ActionResult PickAccount(int id, int projectId)
        {
            AccountInfoViewModel accountDetails = new AccountInfoViewModel();
            BaseResponse         response       = _accountExecutor.PickAccount(Convert.ToInt16(Session["UserId"]), id);

            if (response != null && !response.HasError)
            {
                return(RedirectToAction("GetAccountsDetails", new { projectId = projectId }));
            }

            throw new Exception();
        }
Ejemplo n.º 14
0
        public ActionResult AccountInfo()
        {
            var model  = new AccountInfoViewModel();
            var person = securityProvider.GetPerson(User.Identity.Name);

            model.IsLoggedIn = !String.IsNullOrEmpty(User.Identity.Name);
            if (model.IsLoggedIn)
            {
                model.IsAdministrator = securityProvider.IsAdministrator(User.Identity.Name);
                model.AccountName     = String.Format("{0} {1}", person.FirstName, person.LastName);
            }
            return(PartialView("_AccountInfo", model));
        }
        public async Task <IActionResult> Info(long id, Guid?eid = null)
        {
            var account = await CommonContext.CommonAccounts.Include(m => m.Partition).SingleOrDefaultAsync(m => m.Number == id);

            var model = new AccountInfoViewModel();

            if (account != null)
            {
                model = await GetSampleAccountInfoViewModel(account, eid);
            }

            return(View(model));
        }
Ejemplo n.º 16
0
        public async Task <ActionResult> Info()
        {
            var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());

            var viewModel = new AccountInfoViewModel
            {
                FirstName = user.FirstName,
                LastName  = user.LastName,
                Email     = user.Email
            };

            return(View(viewModel));
        }
Ejemplo n.º 17
0
        public ActionResult EditAccountInfo(string userName)
        {
            var model = new AccountInfoViewModel();
            var user  = Membership.GetUser(userName);

            if (user != null)
            {
                model.Email         = user.Email;
                model.LastLoginDate = user.LastLoginDate;
                model.UserName      = user.UserName;
            }

            return(View("EditAccountInfo", model));
        }
Ejemplo n.º 18
0
        public GetAccountInfoResultType(bool isSuccess = false, string message = "", AccountInfoViewModel accountInfo = null)
        {
            this.IsSuccess = isSuccess;
            this.Message   = message;

            if (accountInfo != null)
            {
                this.AccountInfo = accountInfo;
            }
            else
            {
                this.AccountInfo = new AccountInfoViewModel();
            }
        }
        public ActionResult List()
        {
            var allUsers = UserManager.Users.ToList();
            List <AccountInfoViewModel> Accounts = new List <AccountInfoViewModel>();

            foreach (var user in allUsers)
            {
                AccountInfoViewModel account = new AccountInfoViewModel();
                account.UserName = user.UserName;
                account.Role     = "Admin";
                Accounts.Add(account);
            }
            return(View(Accounts));
        }
Ejemplo n.º 20
0
        public AccountInfoPage()
        {
            InitializeComponent();
            Title = "Account Information";

            _viewModel = new AccountInfoViewModel();
            this.BindingContext = _viewModel;

            this.ToolbarItems.Add(new ToolbarItem("Edit", null, () =>
                    {
                    this.Navigation.PushAsync(new RegistrationPage(true, this, new UserAccount(_viewModel.UserAccount)));
                    }));

            LoadData();
        }
Ejemplo n.º 21
0
        private AccountInfoViewModel ToViewModel(AccountInfo accountInfo)
        {
            var model = new AccountInfoViewModel();

            model.Address         = accountInfo.Address;
            model.Amount          = accountInfo.Amount;
            model.FullName        = accountInfo.FullName;
            model.PersonalNumber  = accountInfo.PersonalNumber;
            model.VendorServiceId = accountInfo.VendorServiceId;
            var findVendorService = _paymentsService.GetVendorServiceById(accountInfo.VendorServiceId);

            model.VendorServiceName = findVendorService.Name;
            model.VendorService     = findVendorService;
            return(model);
        }
Ejemplo n.º 22
0
        public ActionResult Info(AccountInfoViewModel model)
        {
            var user = UserManager.FindById(User.Identity.GetUserId());

            if (user != null)
            {
                user.FirstName = model.FirstName;
                user.LastName  = model.LastName;
                user.Email     = user.Email;
                user.UserName  = user.Email;

                UserManager.Update(user);
            }
            return(View(model));
        }
Ejemplo n.º 23
0
        private bool Contains(AccountInfoViewModel account, string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return(true);
            }

            if (null != account)
            {
                var filter = value.Trim();
                return(Contains(account.Name, filter) || Contains(account.Login, filter) || account.AppsUrls.Any(a => Contains(a, filter)));
            }

            return(false);
        }
        public AccountEditPasswordPage()
        {
            this.InitializeComponent();
            string username = Navigation.Shell.Model.UserName;
            var    userPair = DatabaseModel.UserTable.FirstOrDefault(x => x.Value.UserName == username);
            User   user     = null;

            if (!DatabaseModel.UserTableDefault.Equals(userPair))
            {
                user = userPair.Value;
            }
            AccountInfoViewModel viewModel = new AccountInfoViewModel(user);

            this.ViewModel = viewModel;
        }
Ejemplo n.º 25
0
        public ActionResult EditAccountInfo(AccountInfoViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = Membership.GetUser(model.UserName);

                if (user != null)
                {
                    user.Email = model.Email;
                    Membership.UpdateUser(user);
                }

                return(RedirectToAction("Profile", new { userName = model.UserName }));
            }

            return(View("EditAccountInfo", model));
        }
Ejemplo n.º 26
0
        private int pageSize          = 8; // số lượng item trên 1 trang

        /// <summary>
        /// GET: /Info/Account
        /// Hiển thị các thông tin liên quan đến người dùng: thông tin cá nhân, các mặt hàng đang bán
        /// </summary>
        /// <param name="name"></param>
        /// <param name="username"></param>
        /// <returns></returns>
        public ActionResult AccountInfo(int?page, string username)
        {
            // Lấy ra thông tin của người dùng
            GetAccountInfoResultType getInfoResult = dao.GetAccountInfo(username);

            // lấy thông tin thành công
            if (getInfoResult.IsSuccess)
            {
                AccountInfoViewModel accInfo = getInfoResult.AccountInfo;
                ViewBag.Page = page;
                ViewBag.Name = accInfo.Name;
                return(View(accInfo));
            }

            // đặt lỗi trong TempData để sử dụng hiển thị ra màn hình lỗi
            TempData["Error"] = new ErrorViewModel(InfoActionErrorMsg.GetAccountInfoError);
            return(RedirectToAction("Error", "Info"));
        }
Ejemplo n.º 27
0
        public SuccessAndMsg ChangePersonalDetail(AccountInfoViewModel model)
        {
            var user = db.Users.FirstOrDefault(u => u.Username == model.Username);

            if (user != null)
            {
                user.Username = model.Username;
                user.Address  = model.Address;
                user.Email    = model.Email;
                user.Name     = model.Name;
                user.Phone    = model.Phone;

                db.SaveChanges();
                return(new SuccessAndMsg(true, ChangeUserInfoResult.ChangeUserInfoSuccessful));
            }

            return(new SuccessAndMsg(false, ChangeUserInfoResult.ChangeUserInfoFailed));
        }
Ejemplo n.º 28
0
        /// <summary>
        /// GET: /User/ChangePersonalDetail
        /// Hiển thị thông tin người dùng
        /// </summary>
        /// <returns></returns>
        public ActionResult ChangePersonalDetail()
        {
            AccountInfoViewModel model = new AccountInfoViewModel();

            if (Session["Username"] != null)
            {
                string username = Session["Username"].ToString();

                var user = db.Users.FirstOrDefault(u => u.Username == username);

                if (user != null)
                {
                    // thiết lập thông tin cho model
                    model = new AccountInfoViewModel(user);
                }
            }

            return(View(model));
        }
        private async Task <AccountInfoViewModel> GetSampleAccountInfoViewModel(CommonAccount account, Guid?eventId)
        {
            var model = new AccountInfoViewModel()
            {
                Account = account
            };

            var _accountCtx = ContextsUtility.CreateAccountContext(Cryptography.Decrypt(account.Partition.ConnectionString));

            var events = _accountCtx.Events.ForAccount(account.Id).AsNoTracking();

            if (eventId.HasValue)
            {
                events = events.Where(m => m.Id == eventId.Value);
            }

            model.Events = Mapper.Map <List <AccountEvent> >(await events.OrderByDescending(m => m.CreateUtc).ToListAsync());

            return(model);
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Convert viewmodel to model
 /// </summary>
 /// <param name="viewModel"></param>
 /// <returns></returns>
 private static AccountInfoModel ConvertToModel(AccountInfoViewModel viewModel)
 {
     return(new AccountInfoModel
     {
         AccountInfoId = viewModel.AccountInfoId,
         Address1 = viewModel.Address1,
         Address2 = viewModel.Address2,
         BirthDay = DateTimeUtilities.ParseFromString(viewModel.BirthDay),
         Comment = viewModel.Comment,
         Education = viewModel.Education,
         Email = viewModel.Email,
         Introduce = viewModel.Introduce,
         IsPublished = viewModel.IsPublished,
         JobTitle = viewModel.JobTitle,
         PhoneNumber = viewModel.PhoneNumber,
         Skills = viewModel.Skills,
         AccountId = viewModel.AccountId,
         DisplayName = viewModel.DisplayName,
         FullName = viewModel.FullName
     });
 }
Ejemplo n.º 31
0
        public async Task <IActionResult> AccountInformation(string userName, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            ViewData["UserName"]  = userName;
            if (!User.IsInRole("Admin") && User.Identity.Name != userName)
            {
                return(RedirectToAction("AccessDenied", "Home"));
            }
            var user = await _userManager.FindByNameAsync(userName);

            var model = new AccountInfoViewModel
            {
                Username    = user.UserName,
                FirstName   = user.FirstName,
                LastName    = user.LastName,
                PhoneNumber = user.PhoneNumber,
                Email       = user.Email,
                HasImage    = user.ProfileImageName != null ? true : false
            };

            return(View(model));
        }
Ejemplo n.º 32
0
        public RegistrationPage(bool isUpdate, Page parent, UserAccount userAccount = null)
        {
            InitializeComponent();
            if (!isUpdate)
            {
                Title = "Registration";
            }
            else
            {
                Title = "Update Information";
            }
            _tableView.Intent = TableIntent.Menu;

            if (userAccount == null)
            {
                _viewModel = new AccountInfoViewModel();
            }
            else
            {
                _viewModel = new AccountInfoViewModel(userAccount);
            }
            this.BindingContext = _viewModel;

            #region Birthday
            var birthdayCell = new ViewCell();
            _birthdaySection.Add(birthdayCell);

            var birthdayLayout = new StackLayout
            {
                Padding = new Thickness(10, 0, 10, 0),
            };
            birthdayCell.View = birthdayLayout;

            var datePicker = new DatePicker
            {
                Format = "MMM d yyyy",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.CenterAndExpand,
            };
            birthdayLayout.Children.Add(datePicker);
            datePicker.SetBinding(DatePicker.DateProperty, "UserAccount.Birthday", BindingMode.TwoWay);
            #endregion

            #region Province
            var provinceCellLayout = new StackLayout
            {
                Padding = new Thickness(10, 0, 10, 0),
            };
            _provinceCell.View = provinceCellLayout;

            var provincePicker = new Picker
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.CenterAndExpand,
            };
            provinceCellLayout.Children.Add(provincePicker);

            var firstCountry = DatabaseManager.DbConnection.Table<Country>().First();
            var provinces = DatabaseManager.DbConnection.Table<Province>().Where(x => x.CountryCode == firstCountry.CountryCode).ToList();
            foreach (var province in provinces)
            {
                provincePicker.Items.Add(province.ProvinceName);
            }
            provincePicker.SetBinding(Picker.SelectedIndexProperty, new Binding("UserAccount.Province", BindingMode.TwoWay, new PickerProvinceToIndexConverter(), provinces));
            #endregion

            #region Country
            var countryCellLayout = new StackLayout
            {
                Padding = new Thickness(10, 0, 10, 0),
            };
            _countryCell.View = countryCellLayout;

            var countryPicker = new Picker
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.CenterAndExpand,
            };
            countryCellLayout.Children.Add(countryPicker);

            var countries = DatabaseManager.DbConnection.Table<Country>().ToList();
            foreach (var country in countries)
            {
                countryPicker.Items.Add(country.CountryName);
            }
            countryPicker.SetBinding(Picker.SelectedIndexProperty, new Binding("UserAccount.Country", BindingMode.TwoWay, new PickerCountryToIndexConverter(), countries));

            countryPicker.SelectedIndexChanged += (sender, e) =>
            {
                provincePicker.Items.Clear();

                var countryCode = countries[countryPicker.SelectedIndex].CountryCode;
                var newProvinces = DatabaseManager.DbConnection.Table<Province>().Where(x => x.CountryCode == countryCode).ToList();

                // If there is no province, use N/A
                if ((newProvinces == null) || (newProvinces.Count == 0))
                {
                    newProvinces = new List<Province>
                    {
                        new Province
                        {
                            ProvinceName = "N/A",
                        }
                    };
                }

                foreach (var province in newProvinces)
                {
                    provincePicker.Items.Add(province.ProvinceName);
                }
                provincePicker.SetBinding(Picker.SelectedIndexProperty, new Binding("UserAccount.Province", BindingMode.TwoWay, new PickerProvinceToIndexConverter(), newProvinces));
            };
            #endregion

            #region Raffle Result
            var raffleResultsViewCell = new ViewCell();
            _raffleResultsSection.Add(raffleResultsViewCell);

            var raffleResultsLayout = new StackLayout
            {
                Padding = new Thickness(10, 0, 10, 0),
            };
            raffleResultsViewCell.View = raffleResultsLayout;

            var raffleResultsPicker = new Picker
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.CenterAndExpand,
            };
            raffleResultsLayout.Children.Add(raffleResultsPicker);

            foreach (var item in c_contactMethods)
            {
                raffleResultsPicker.Items.Add(item);
            }
            raffleResultsPicker.SetBinding(Picker.SelectedIndexProperty, new Binding("UserAccount.PreferedContactMethod", BindingMode.TwoWay, new PickerContactMethodsConverter()));
            #endregion

            #region Charity Message
            var charityMessagesViewCell = new ViewCell();
            _charityMessagesSection.Add(charityMessagesViewCell);

            var charityMessagesLayout = new StackLayout
            {
                Padding = new Thickness(10, 0, 10, 0),
            };
            charityMessagesViewCell.View = charityMessagesLayout;

            var charityMessagesPicker = new Picker
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.CenterAndExpand,
            };
            charityMessagesLayout.Children.Add(charityMessagesPicker);

            foreach (var item in c_contactMethods)
            {
                charityMessagesPicker.Items.Add(item);
            }
            charityMessagesPicker.SetBinding(Picker.SelectedIndexProperty, new Binding("UserAccount.PreferedContactMethodCharity", BindingMode.TwoWay, new PickerContactMethodsConverter()));
            #endregion

            if (!isUpdate)
            {
                var createAccountButtonViewCell = new ViewCell();
                _createAccountButtonSection.Add(createAccountButtonViewCell);

                var createAccountButtonLayout = new StackLayout
                {
                    Padding = new Thickness(5, 0, 5, 0),
                    BackgroundColor = Color.Accent,
                };
                createAccountButtonViewCell.View = createAccountButtonLayout;

                var createAccountButton = new Button
                {
                    Text = "Create Account",
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    TextColor = Color.White,
                };
                createAccountButtonLayout.Children.Add(createAccountButton);

                createAccountButton.Clicked += async (sender, e) =>
                {
                    var result = await _viewModel.CreateAccount();
                    if (result.Item1)
                    {
                        this.Navigation.PopAsync();
                        var answer = await DisplayAlert("Register Phone Number", "Send registration code to your phone now?", "Later", "Yes");
                        if (!answer) // use !answer because the negative choice has a bigger font
                        {
                            parent.Navigation.PushAsync(new VerifyPhonePage(_viewModel.UserAccount.Email, _viewModel.UserAccount.Phone, _viewModel.UserAccount.CountryCode)); //Country code is updated after calling _viewModel.CreateAccount()
                        }
                    }
                    else
                    {
                        DisplayAlert("Server request failed", "", "OK");
                    }
                };
            }
            else
            {
                // Edit Account Page
                _toolbarItemIsEnabled = true;

                _onDoneButtonClicked = new Command(async () =>
                    {
                        if (_toolbarItemIsEnabled)
                        {
                            if (_viewModel.InfoHasNotChanged())
                            {
                                DisplayAlert("Warning", "Your information has not changed.", "Retry");
                            }
                            else
                            {
                                _toolbarItemIsEnabled = false; // Disable the button while await
                                var result = await _viewModel.UpdateAccountInfo();
                                _toolbarItemIsEnabled = true;
                                if (result.Item1)
                                {
                                    this.Navigation.InsertPageBefore(new AccountInfoPage(), parent);
                                    this.Navigation.PopAsync(false);
                                    this.Navigation.PopAsync(false);
                                }
                                else
                                {
                                    DisplayAlert("Error", result.Item2, "Retry");
                                }
                            }
                        }
                    });

                var toolbarItem = new ToolbarItem
                {
                    Text = "Done",
                    Command = _onDoneButtonClicked,
                };
                this.ToolbarItems.Add(toolbarItem);
            }
        }