Beispiel #1
0
        public async Task <IActionResult> Cabinet(CabinetViewModel model)
        {
            ViewBag.Ban1 = db.Banners.FirstOrDefault(p => p.NameBanner == "banner1");
            ViewBag.Ban2 = db.Banners.FirstOrDefault(p => p.NameBanner == "banner2");
            ViewBag.Ban3 = db.Banners.FirstOrDefault(p => p.NameBanner == "banner3");
            ViewBag.Ban4 = db.Banners.FirstOrDefault(p => p.NameBanner == "banner4");
            ViewBag.Ban5 = db.Banners.FirstOrDefault(p => p.NameBanner == "banner5");

            // по куки определяют пользователя
            var user = await _userManager.GetUserAsync(User);

            if (user == null)
            {
                throw new ApplicationException($"Unable to load user with ID '{_userManager.GetUserId(User)}'.");
            }

            // передает данные на страницу
            model.Email = user.Fio;
            var city = db.PodCities.SingleOrDefault(p => p.Id == user.PodCityId);

            model.City        = city.Name;
            model.PhoneNumber = user.PhoneNumber;

            return(View(model));
        }
Beispiel #2
0
        public async Task <IActionResult> Header()
        {
            var model = new CabinetViewModel();

            model.UserId = HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var name = await _authService.GetUser(model.UserId);

            model.UserName = name.DisplayName;

            return(PartialView(model));
        }
Beispiel #3
0
        public ActionResult Index()
        {
            var userId = new WebUser().UserId;
            var model  = new CabinetViewModel
            {
                User   = _userService.GetUser(userId),
                Cities = _sitePageSevice.GetAllCities()
            };

            return(View(model));
        }
        public ActionResult Cabinet()
        {
            ApplicationUser user = UserManager.FindByEmail(User.Identity.Name);

            if (user != null)
            {
                CabinetViewModel model = new CabinetViewModel {
                    FirstName = user.FirstName, LastName = user.LastName, Birth = user.Birth, MiddleName = user.MiddleName, Sex = user.Sex, PhoneNumber = user.PhoneNumber, Address = user.Address
                };
                return(View(model));
            }
            return(RedirectToAction("Login", "Account"));
        }
 public Cabinet()
 {
     InitializeComponent();
     DataContext = new CabinetViewModel();
 }
Beispiel #6
0
 public CabinetPage()
 {
     InitializeComponent();
     _viewModel     = new CabinetViewModel();
     BindingContext = _viewModel;
 }