public virtual ActionResult AddCompany(AddCompanyViewModel model) { if (model.ExistingCompanyId == 0 && !model.CreateNewCompany) { ModelState.AddModelError("", "You must either mark to create a new company, or select a company to sync with"); } if (!ModelState.IsValid) { var jobSearch = _context.Users.Where(x => x.Id == CurrentUserId).Select(x => x.LastVisitedJobSearch).Single(); model.CreateCompanyList(jobSearch); return(View(model)); } if (model.CreateNewCompany) { var result = _addCompanyProcess.Execute(new AddJigsawCompanyParams { JigsawId = model.JigsawId, RequestingUserId = CurrentUserId }); return(RedirectToAction(MVC.CompanySearch.Jigsaw.AddCompanySuccess(result.CompanyId, result.CompanyName))); } // else return(RedirectToAction(MVC.CompanySearch.Jigsaw.Sync(model.ExistingCompanyId, model.JigsawId))); }
public virtual ActionResult AddCompany(int jigsawId, string companyName) { var jobSearch = _context.Users.Where(x => x.Id == CurrentUserId).Select(x => x.LastVisitedJobSearch).Single(); var model = new AddCompanyViewModel { JigsawId = jigsawId, JigsawCompanyName = companyName }; model.CreateCompanyList(jobSearch); return(View(model)); }