Пример #1
0
        public async Task <IActionResult> MyAccount(EmployeeViewModel employee)
        {
            var user = await _userManager.GetUserAsync(HttpContext.User);

            Employee newEmployee = _employeeSevice.GetAll().Where(e => e.UserId == user.Id).First();

            var proffesions = new List <Proffesion>();

            if (employee.SelectedProffesions != null)
            {
                foreach (var selectedProffesion in employee.SelectedProffesions)
                {
                    proffesions.Add(_proffesionService.GetById(selectedProffesion));
                }
            }

            newEmployee.Proffesions    = proffesions;
            newEmployee.ExperienceTime = employee.ExperienceTime;
            newEmployee.CVUrl          = employee.CVUrl;
            _employeeSevice.UpdateItem(newEmployee);
            user.Email       = employee.Email;
            user.UserName    = employee.Nickname;
            user.Description = employee.Description;
            await _userManager.UpdateAsync(user);

            return(RedirectToAction("Index", "Home"));
        }
Пример #2
0
        public async Task <IActionResult> MyAccount(EmployerViewModel employer)
        {
            var user = await _userManager.GetUserAsync(HttpContext.User);

            Employer newEmployer = _employerService.GetAll().Where(e => e.UserId == user.Id).First();

            newEmployer.JobConditions = employer.JobConditions;
            newEmployer.Proffesion    = _proffesionService.GetById(employer.SelectedProffesion);
            _employerService.UpdateItem(newEmployer);
            user.Email       = employer.Email;
            user.UserName    = employer.Nickname;
            user.Description = employer.Description;
            await _userManager.UpdateAsync(user);

            return(RedirectToAction("Index", "Home"));
        }