예제 #1
0
        public IActionResult Index(int?page)
        {
            int currentpage;

            if (page == null)
            {
                currentpage = 1;
            }
            else
            {
                currentpage = (int)page;
            }

            var maxcount = currentpage < 5 ? 5 : currentpage + 2;
            var mincount = currentpage < 5 ? 1 : currentpage - 2;

            var maxpage = (_Services.Accounts().Count() / 10) + 1;

            maxcount = currentpage <= maxpage ? maxcount : maxpage;
            var result = _Services.AccountsPage(currentpage);
            var model  = new AccountIndexViewModel();

            model.Accounts      = result;
            ViewBag.MaxCount    = maxcount;
            ViewBag.MinCount    = mincount;
            ViewBag.CurrentPage = currentpage;
            ViewBag.MaxPage     = maxpage;
            return(View(model));
        }
        public async Task <IActionResult> Index()
        {
            var currentUser = await GetCurrentUserAsync();

            if (currentUser == null)
            {
                throw new Exception("Current user not found");
            }

            string officeName = null;

            if (currentUser.OfficeId != null)
            {
                officeName = await _dal.GetOfficeName(currentUser.OfficeId);
            }

            var model = new AccountIndexViewModel
            {
                Email      = currentUser.Email,
                Phone      = currentUser.Phone,
                FullName   = currentUser.FullName,
                OfficeName = officeName,
                Roles      = await _userManager.GetRolesAsync(currentUser)
            };

            return(View(model));
        }
예제 #3
0
        public IActionResult Cabinet()
        {
            if (_auth.User == null)
            {
                return(RedirectToAction("index", "account"));
            }
            else
            {
                User LoginedUser = _context.Users.Where(u => u.UserId == _auth.User.UserId).FirstOrDefault();

                if (LoginedUser == null)
                {
                    return(BadRequest());
                }
                else
                {
                    ViewBag.AllAddsCount = _context.Addvertisiments.Where(a => a.UserId == _auth.User.UserId && a.AddStatus != AddStatus.Hidden).Count();

                    ViewBag.ActiveAddsCount = _context.Addvertisiments.Where(a => a.UserId == _auth.User.UserId && a.AddStatus == AddStatus.Active).ToList().Count();

                    ViewBag.DeactiveAddsCount = _context.Addvertisiments.Where(a => a.UserId == _auth.User.UserId && a.AddStatus == AddStatus.Deactive).Count();

                    ViewBag.WaitingAddsCount = _context.Addvertisiments.Where(a => a.UserId == _auth.User.UserId && a.AddStatus == AddStatus.Waiting).Count();

                    ViewBag.RentAddsCount = _context.Addvertisiments.Where(a => a.UserId == _auth.User.UserId && a.AddTypeID < 3 && a.AddStatus == AddStatus.Active).Count();

                    ViewBag.SaleAddsCount = _context.Addvertisiments.Where(a => a.UserId == _auth.User.UserId && a.AddTypeID == 3 && a.AddStatus == AddStatus.Active).Count();


                    AccountIndexViewModel data = new AccountIndexViewModel
                    {
                        Cabinet = new AccountCabinetModel
                        {
                            AllAdds = _context.Addvertisiments.Include("User").Include("Property").Include("Property.City").Include("Property.District").Include("Property.PropertySort").Where(a => a.UserId == _auth.User.UserId && a.AddStatus != AddStatus.Hidden).OrderByDescending(a => a.CreatedAt).ToList()
                        },
                        Breadcumb = new BreadcumbViewModel
                        {
                            Title = "Şəxsi kabinet",
                            Path  = new List <BreadcumbItemViewModel>()
                        }
                    };


                    BreadcumbItemViewModel home = new BreadcumbItemViewModel
                    {
                        Name       = "Ana səhifə",
                        Controller = "Home",
                        Action     = "index"
                    };
                    BreadcumbItemViewModel cab = new BreadcumbItemViewModel
                    {
                        Name = "Şəxsi kabinet"
                    };
                    data.Breadcumb.Path.Add(home);
                    data.Breadcumb.Path.Add(cab);
                    ViewBag.Partial = data.Breadcumb;
                    return(View(data));
                }
            }
        }
예제 #4
0
        public IActionResult Signup()
        {
            AccountIndexViewModel data = new AccountIndexViewModel()
            {
                Breadcumb = new BreadcumbViewModel
                {
                    Title = "Yeni üzv",
                    Path  = new List <BreadcumbItemViewModel>()
                },
            };

            BreadcumbItemViewModel home = new BreadcumbItemViewModel
            {
                Name       = "Ana səhifə",
                Controller = "Home",
                Action     = "index"
            };
            BreadcumbItemViewModel signup = new BreadcumbItemViewModel
            {
                Name = "Qeydiyyat"
            };

            data.Breadcumb.Path.Add(home);
            data.Breadcumb.Path.Add(signup);
            ViewBag.Partial   = data.Breadcumb;
            ViewBag.UserTypes = _context.UserTypes.OrderBy(u => u.UserTypeId).ToList();
            return(View());
        }
예제 #5
0
        public IActionResult Settings()
        {
            if (_auth.User == null)
            {
                return(RedirectToAction("index", "account"));
            }

            AccountIndexViewModel data = new AccountIndexViewModel
            {
                Breadcumb = new BreadcumbViewModel
                {
                    Title = "Tənzimləmələr",
                    Path  = new List <BreadcumbItemViewModel>()
                },
            };
            BreadcumbItemViewModel home = new BreadcumbItemViewModel
            {
                Name       = "Ana səhifə",
                Controller = "Home",
                Action     = "index"
            };
            BreadcumbItemViewModel settings = new BreadcumbItemViewModel
            {
                Name = "Tənzimləmələr"
            };

            data.Breadcumb.Path.Add(home);
            data.Breadcumb.Path.Add(settings);
            ViewBag.Partial = data.Breadcumb;

            ViewBag.User = _auth.User;
            return(View());
        }
예제 #6
0
        public IActionResult Index()
        {
            AccountIndexViewModel data = new AccountIndexViewModel()
            {
                Breadcumb = new BreadcumbViewModel
                {
                    Title = "Şəxsi kabinetə giriş",
                    Path  = new List <BreadcumbItemViewModel>()
                },
            };

            BreadcumbItemViewModel home = new BreadcumbItemViewModel
            {
                Name       = "Ana səhifə",
                Controller = "Home",
                Action     = "index"
            };
            BreadcumbItemViewModel login = new BreadcumbItemViewModel
            {
                Name = "Daxil Ol"
            };

            data.Breadcumb.Path.Add(home);
            data.Breadcumb.Path.Add(login);
            ViewBag.Partial = data.Breadcumb;
            return(View());
        }
        protected async override void OnAppearing()
        {
            using (UserDialogs.Instance.Loading(InfoText.PopupLoading_Text))
            {
                _viewModel = new AccountIndexViewModel();
                var userDetailsResponse = await AuthenticationService.UserDetailsApi(new AuthenticationService.UserDetailsRequest()
                {
                    userID = DB.GetValue(StorageEnum.UserID).ToInt(),
                });

                if (userDetailsResponse.Error.IsEmpty())
                {
                    _viewModel.Account = userDetailsResponse;
                }
                else
                {
                    await ErrorAlert(this, userDetailsResponse.Error);
                }

                this.BindingContext = _viewModel;
            }

            //_viewModel = new AccountIndexViewModel();
            //this.BindingContext = _viewModel;
        }
예제 #8
0
        public ActionResult Index(int?page, int?currentRankFilter, string currentPriceFilter, string currentSkinFilter, string currentChampFilter, string currentOrderBy)
        {
            int pageIndex = page ?? 1;

            AccountIndexViewModel viewModel = new AccountIndexViewModel()
            {
                DataSource         = Filter(pageIndex, currentRankFilter, currentPriceFilter, currentSkinFilter, currentChampFilter, currentOrderBy),
                RanksFilter        = _accountRelationDataService.ReadRankForFilter(),
                PriceFilter        = _accountRelationDataService.ReadPriceRangeForFilter(),
                CurrentRankFilter  = currentRankFilter,
                CurrentPriceFilter = currentPriceFilter,
                CurrentSkinFilter  = currentSkinFilter,
                CurrentChampFilter = currentChampFilter,
                CurrentOrderBy     = currentOrderBy
            };

            if (Session["NewsLoaded"] == null)
            {
                var path = Server.MapPath("~/New.txt");
                viewModel.News        = NewExternalService.ReadNew(path);
                Session["NewsLoaded"] = true;
            }

            var pathRandom = Server.MapPath("~/Images/RandomImage");

            SetRandomImage(pathRandom, viewModel.DataSource);

            return(View(viewModel));
        }
        public IActionResult Index()
        {
            AccountIndexViewModel vm = new AccountIndexViewModel();

            vm.User = authProvider.GetCurrentUser();
            return(View(vm));
        }
예제 #10
0
        public ActionResult Index()
        {
            var model = new AccountIndexViewModel();

            var userId   = User.Identity.GetUserId();
            var fromDate = DateTime.Now.AddMonths(-1);
            var orders   = orderService.FindAll()
                           .Where(o => o.UserId == userId && o.DatePlaced >= fromDate)
                           .OrderByDescending(o => o.DateUpdated)
                           .ToList();

            Mapper.Map(orders, model.Orders);
            foreach (var order in model.Orders)
            {
                foreach (var item in order.Items)
                {
                    string optionsDisplay = "";
                    var    options        = JsonConvert.DeserializeObject <OrderItemOption[]>(item.Options);
                    foreach (var optionId in options.Select(o => o.Id))
                    {
                        var option = optionService.Find(optionId);
                        if (option == null)
                        {
                            continue;
                        }
                        optionsDisplay += string.Format("<strong>{0}</strong>: {1} ", option.Category.Name, option.Name);
                    }
                    item.OptionsDisplay = optionsDisplay;
                }
            }

            return(View(model));
        }
예제 #11
0
        public ActionResult Index()
        {
            var model = new AccountIndexViewModel();

            var userId = User.Identity.GetUserId();
            var fromDate = DateTime.Now.AddMonths(-1);
            var orders = orderService.FindAll()
                .Where(o => o.UserId == userId && o.DatePlaced >= fromDate)
                .OrderByDescending(o => o.DateUpdated)
                .ToList();
            Mapper.Map(orders, model.Orders);
            foreach (var order in model.Orders)
            {
                foreach (var item in order.Items)
                {
                    string optionsDisplay = "";
                    var options = JsonConvert.DeserializeObject<OrderItemOption[]>(item.Options);
                    foreach (var optionId in options.Select(o => o.Id))
                    {
                        var option = optionService.Find(optionId);
                        if (option == null) continue;
                        optionsDisplay += string.Format("<strong>{0}</strong>: {1} ", option.Category.Name, option.Name);
                    }
                    item.OptionsDisplay = optionsDisplay;
                }
            }

            return View(model);
        }
예제 #12
0
        public ActionResult Index(string logOnReturnUrl, string registerReturnUrl)
        {
            var viewModel = new AccountIndexViewModel
            {
                CreateAccountViewModel = new CreateAccountViewModel(registerReturnUrl),
                LogOnViewModel         = new LogOnViewModel(logOnReturnUrl),
            };

            if (TempData[RegistrationValidationSummaryKey] != null)
            {
                viewModel.RegistrationValidationIssueOccurred = true;
                viewModel.RegistrationValidationSummary       = (string)TempData[RegistrationValidationSummaryKey];
            }

            if (TempData[LoggingOnValidationSummaryKey] != null)
            {
                viewModel.LoggingOnValidationIssueOccurred = true;
                viewModel.LoggingOnValidationSummary       = (string)TempData[LoggingOnValidationSummaryKey];
            }

            if (TempData[PasswordHasBeenUpdatedKey] != null)
            {
                viewModel.PasswordHasBeenUpdated = (bool)TempData[PasswordHasBeenUpdatedKey];
            }

            return(View(viewModel));
        }
예제 #13
0
        public async Task <ActionResult> Index(AccountIndexMessageId?message)
        {
            ViewBag.StatusMessage =
                message == AccountIndexMessageId.ChangePasswordSuccess ? LocalizedStrings.Account_YourPasswordHasBeenChanged
                : message == AccountIndexMessageId.SetPasswordSuccess ? LocalizedStrings.Account_YourPasswordHasBeenSet
                : message == AccountIndexMessageId.SetTwoFactorSuccess ? LocalizedStrings.Account_YourTwoFactorAuthenticationHasBeenSet
                : message == AccountIndexMessageId.Error ? LocalizedStrings.Account_MessageError
                : message == AccountIndexMessageId.AddPhoneSuccess ? LocalizedStrings.Account_MessageAddPhoneSuccess
                : message == AccountIndexMessageId.RemovePhoneSuccess ? LocalizedStrings.Account_MessageRemovePhoneSuccess
                : "";

            var userId = User.Identity.GetUserId <int>();

            if (userId != default(int))
            {
                var user = await UserManager.FindByIdAsync(userId);

                var model = new AccountIndexViewModel {
                    UserName          = user.UserName,
                    FullName          = user.FullName,
                    HasPassword       = HasPassword(),
                    PhoneNumber       = user.PhoneNumber,
                    TwoFactor         = user.TwoFactorEnabled,
                    Logins            = await UserManager.GetLoginsAsync(userId),
                    BrowserRemembered = await AuthenticationManager.TwoFactorBrowserRememberedAsync(User.Identity.GetUserId()), // string always?
                };
                return(View(model));
            }
            return(RedirectToAction("Index", "Home"));
        }
예제 #14
0
        public IActionResult Index()
        {
            AccountIndexViewModel users = new AccountIndexViewModel {
                Users = _userManager.Users
            };

            return(View(users));
        }
예제 #15
0
        // **************************************
        // URL: /Account/Admin
        // **************************************

        public ActionResult Admin()
        {
            Models.AccountIndexViewModel UsersList = new AccountIndexViewModel
            {
                Users = Membership.GetAllUsers()
            };

            return(View(UsersList));
        }
예제 #16
0
        public IActionResult Login(AccountLoginModel Login)
        {
            if (ModelState.IsValid)
            {
                User user = _context.Users.Where(u => u.Email == Login.Email).FirstOrDefault();

                if (user != null)
                {
                    if (Crypto.VerifyHashedPassword(user.Password, Login.Password))
                    {
                        user.Token = Guid.NewGuid().ToString();
                        _context.SaveChanges();

                        Response.Cookies.Append("token", user.Token, new Microsoft.AspNetCore.Http.CookieOptions
                        {
                            Expires  = DateTime.Now.AddYears(1),
                            HttpOnly = true
                        });
                        TempData["Success"] = "Sistemə müvəffəqiyyətlə daxil oldunuz...";
                        return(RedirectToAction("index", "home"));
                    }
                    else
                    {
                        ModelState.AddModelError("Login.Password", "E-poçt və ya şifrə yalnışdır");
                    }
                }
                else
                {
                    ModelState.AddModelError("Login.Password", "E-poçt və ya şifrə yalnışdır");
                }
            }
            AccountIndexViewModel data = new AccountIndexViewModel
            {
                Login = Login
            };

            data.Breadcumb = new BreadcumbViewModel
            {
                Title = "Şəxsi kabinetə giriş",
                Path  = new List <BreadcumbItemViewModel>()
            };
            BreadcumbItemViewModel home = new BreadcumbItemViewModel
            {
                Name       = "Ana səhifə",
                Controller = "Home",
                Action     = "index"
            };
            BreadcumbItemViewModel login = new BreadcumbItemViewModel
            {
                Name = "Daxil Ol"
            };

            data.Breadcumb.Path.Add(home);
            data.Breadcumb.Path.Add(login);
            ViewBag.Partial = data.Breadcumb;
            return(View("~/Views/Account/Index.cshtml"));
        }
        public IActionResult IndexByName(string name)
        {
            var viewmodel = new AccountIndexViewModel();

            var runs = _runFinder.GetAll();

            viewmodel.Attemps = runs.Count(x => x.Players.Any(y => y.Name == name));

            return(View("Index", viewmodel));
        }
예제 #18
0
        public IActionResult Index()
        {
            AccountIndexViewModel viewModel = new AccountIndexViewModel();

            if (HttpContext.Session.GetObject <Account>("User") != null)
            {
                viewModel.Account = HttpContext.Session.GetObject <Account>("User");
            }
            return(View(viewModel));
        }
예제 #19
0
        public IActionResult AccountIndex()
        {
            var viewModel = new AccountIndexViewModel();

            viewModel.TotalAccounts  = _dbContext.Accounts.Count();
            viewModel.TotalCustomers = _dbContext.Customers.Count();
            viewModel.TotalBalance   = _dbContext.Accounts.Sum(r => r.Balance);

            return(View(viewModel));
        }
예제 #20
0
        public IActionResult Index()
        {
            AccountIndexViewModel viewModel = new AccountIndexViewModel();

            if (_userSession.GetSession != null)
            {
                viewModel.Account = _userSession.GetSession;
            }
            return(View(viewModel));
        }
        public IActionResult IndexById(string id)
        {
            var playerId = Guid.Parse(id).ToString();
            var runs     = _runFinder.GetAll();

            var viewmodel = new AccountIndexViewModel(playerId);

            viewmodel.Attemps = runs.Count(x => x.Players.Any(y => y.Id == playerId));

            return(View("Index", viewmodel));
        }
예제 #22
0
 public ActionResult Index()
 {
     if (User.Identity.IsAuthenticated)
         return Redirect(Url.RouteUrl("Uyeler_profil"));
     if (ConfigurationSettings.AppSettings["IsDevelopment"].Equals("true"))
         return SignInForDevelopment();
     AccountIndexViewModel model = new AccountIndexViewModel();
     model.SignIn = new SignInViewModel();
     model.SignUp = new SignUpViewModel();
     return View(model);
 }
예제 #23
0
 public IActionResult Index()
 {
     var searchHistory = api.GetSearchHistory(Guid.Parse(User.FindFirstValue(ClaimTypes.Sid)));
     var model = new AccountIndexViewModel(){
         name = User.Identity.Name,
         email = User.FindFirstValue(ClaimTypes.Email),
         history = new List<History>(searchHistory),
         modifyPassword = new ModifyPasswordViewModel()
     };
     return View(model);
 }
예제 #24
0
        public AccountIndexViewModel MapAccountIndexViewModel(string username)
        {
            var accounts = FinancialPlannerRepository.GetAccounts()
                           .Where(m => m.UserName == username);

            var vm = new AccountIndexViewModel
            {
                Accounts = SetViewModelsService.SetAccountViewModels(accounts)
            };

            return(vm);
        }
예제 #25
0
        public async Task <IActionResult> Index()
        {
            List <ApplicationUser> users = _userManager.Users.ToList();
            var currentUser = await _userManager.GetUserAsync(User);

            var model = new AccountIndexViewModel
            {
                Users  = users,
                UserID = currentUser.Id
            };

            return(View(model));
        }
예제 #26
0
        public async Task <IActionResult> Index()
        {
            var user = await userService.GetCurrentUser();

            var model = new AccountIndexViewModel
            {
                User     = user,
                Profiles = new List <object> {
                    null
                },
            };

            return(View(model));
        }
예제 #27
0
        public IActionResult Register(AccountRegisterModel register)
        {
            if (ModelState.IsValid)
            {
                if (!_context.Users.Any(u => u.Email == register.Email))
                {
                    User user = new User
                    {
                        Email     = register.Email,
                        Username  = register.Username,
                        Password  = Crypto.HashPassword(register.Password),
                        CreatedAt = DateTime.Now,
                        Token     = Guid.NewGuid().ToString(),
                        IsCompany = register.IsCompany
                    };

                    _context.Users.Add(user);
                    _context.SaveChanges();

                    Response.Cookies.Append("token", user.Token, new Microsoft.AspNetCore.Http.CookieOptions
                    {
                        Expires  = DateTime.Now.AddYears(1),
                        HttpOnly = true
                    });
                    return(RedirectToAction("profile", "account"));
                }

                else
                {
                    ModelState.AddModelError("Email", "This user is already in registered");
                }
            }

            AccountIndexViewModel data = new AccountIndexViewModel
            {
                Register = register
            };

            data.Breadcumb = new BreadcumbViewModel
            {
                Title = "Register",
                Path  = new Dictionary <string, string>()
            };
            data.Breadcumb.Path.Add("index", "Home");
            data.Breadcumb.Path.Add("Register", null);

            ViewBag.Partial = data.Breadcumb;

            return(View("~/Views/Account/Register.cshtml"));
        }
예제 #28
0
        public async Task <IActionResult> Index()
        {
            var user = await userManager.FindByIdAsync(HttpContext.User.GetUserId());

            var model = new AccountIndexViewModel
            {
                HasPassword       = (user.PasswordHash.Length > 0),
                PhoneNumber       = user.PhoneNumber,
                TwoFactor         = user.TwoFactorEnabled,
                Logins            = await userManager.GetLoginsAsync(user),
                BrowserRemembered = await signInManager.IsTwoFactorClientRememberedAsync(user)
            };

            return(View(model));
        }
예제 #29
0
        public ActionResult Index()
        {
            var AccountIndexViewModels = new List <AccountIndexViewModel>();

            foreach (var user in Database.Users)
            {
                var accountIndexViewModel = new AccountIndexViewModel();
                accountIndexViewModel.Id       = user.Id;
                accountIndexViewModel.UserName = user.UserName;
                accountIndexViewModel.Email    = user.Email;
                accountIndexViewModel.Roles    = string.Join(", ", UserManager.GetRoles(user.Id));
                AccountIndexViewModels.Add(accountIndexViewModel);
            }

            return(View(AccountIndexViewModels));
        }
예제 #30
0
        public IActionResult Login()
        {
            AccountIndexViewModel data = new AccountIndexViewModel();

            data.Breadcumb = new BreadcumbViewModel
            {
                Title = "Login",
                Path  = new Dictionary <string, string>()
            };
            data.Breadcumb.Path.Add("index", "Home");
            data.Breadcumb.Path.Add("Login", null);

            ViewBag.Partial = data.Breadcumb;

            return(View());
        }
예제 #31
0
        public async Task <IActionResult> Index()
        {
            var user = await _userManager.FindByNameAsync(User.Identity.Name);

            if (user != null)
            {
                var indexVm = new AccountIndexViewModel
                {
                    Email    = user.Email,
                    UserName = user.UserName,
                    FullName = user.FullName
                };
                return(View(indexVm));
            }
            return(RedirectToAction("Login", "Account"));
        }
예제 #32
0
        public ActionResult UserInfo(Guid?id)
        {
            var user       = _userRepository.GetItemById(id.Value);
            var userClaims = _userClaimsRepository.GetItemById(user.UserClaimsId);

            var model = new AccountIndexViewModel()
            {
                Id       = user.Id,
                Email    = user.Email,
                Name     = userClaims.Name,
                LastName = userClaims.LastName,
                Phone    = userClaims.Phone
            };

            return(View(model));
        }