예제 #1
0
        public virtual ActionResult AddPosition(string positionId, string positionTitle, string companyName)
        {
            var user = _context.Users.Where(x => x.Id == CurrentUserId).Single();
            var companies = _companyByJobSearchQuery.WithJobSearchId((int)user.LastVisitedJobSearchId).Execute();
            var model = new AddPositionViewModel
            {
                CompanyName = companyName,
                PositionId = positionId,
                PositionTitle = positionTitle,
                DataSource = DomainModel.Enums.ExternalDataSource.LinkedIn
            };
            model.SetCompanyList(companies);

            return View(model);
        }
예제 #2
0
        public virtual ActionResult AddPosition(AddPositionViewModel model)
        {
            if (!_verifyTokenProcess.Execute(new VerifyUserLinkedInAccessTokenParams { UserId = CurrentUserId }).AccessTokenValid)
                return RedirectToAction(MVC.PositionSearch.LinkedIn.AuthorizationAlert());

            if (!model.CreateNewCompany && model.SelectedCompany <= 0)
                ModelState.AddModelError("company", "You must either select to add a new company entry, or select an existing company to add the position to");

            if (!ModelState.IsValid)
            {
                var user = _context.Users.Where(x => x.Id == CurrentUserId).Single();
                var companies = _companyByJobSearchQuery.WithJobSearchId((int)user.LastVisitedJobSearchId).Execute();
                model.SetCompanyList(companies);
                return View(model);
            }

            var result = _addPositionProcess.Execute(new AddLinkedInPositionParams
            {
                RequestingUserId = CurrentUserId,
                CreateNewCompany = model.CreateNewCompany,
                PositionId = model.PositionId,
                ExistingCompanyId = model.SelectedCompany
            });

            return RedirectToAction(MVC.PositionSearch.LinkedIn.AddPositionSuccessful(result.CompanyId, result.CompanyName, result.PositionId, result.PositionTitle));
        }