public async Task <IActionResult> MyAccount()
        {
            var user = await _userManager.GetUserAsync(HttpContext.User);

            Employee      employee            = _employeeSevice.GetAll().Where(e => e.UserId == user.Id).First();
            List <string> selectedProffesions = new List <string>();

            if (employee.Proffesions != null)
            {
                foreach (var proffesion in employee.Proffesions)
                {
                    selectedProffesions.Add(proffesion.Id);
                }
            }
            EmployeeViewModel model = new EmployeeViewModel()
            {
                Nickname            = user.UserName,
                Description         = user.Description,
                ProffesionOptions   = new SelectList(_proffesionService.GetAll(), nameof(Proffesion.Id), nameof(Proffesion.Title)),
                SelectedProffesions = selectedProffesions.ToArray(),
                Email          = user.Email,
                ExperienceTime = employee.ExperienceTime,
                CVUrl          = employee.CVUrl,
                Id             = user.Id
            };

            return(View(model));
        }
示例#2
0
        public async Task <IActionResult> MyAccount()
        {
            var user = await _userManager.GetUserAsync(HttpContext.User);

            Employer          employer = _employerService.GetAll().Where(e => e.UserId == user.Id).First();
            EmployerViewModel model    = new EmployerViewModel()
            {
                Nickname          = user.UserName,
                Description       = user.Description,
                Email             = user.Email,
                JobConditions     = employer.JobConditions,
                ProffesionOptions = new SelectList(_proffesionService.GetAll(), nameof(Proffesion.Id), nameof(Proffesion.Title), employer.Proffesion?.Id),
                Id = user.Id
            };

            return(View(model));
        }