public async Task<ActionResult> Wizard(Wizard model) { if (!ModelState.IsValid) return View(model) .WithError("Han ocurrido errores de validación que no permiten continuar el proceso"); var jobOpportunity = model.ToEntity(); var jobExists = _jobOpportunityService.JobExists(model.Id); if (!jobExists) { _jobOpportunityService.CreateNewJobOpportunity(jobOpportunity, User.Identity.GetUserId()); } else { _jobOpportunityService.UpdateJobOpportunity(model.Id, model.ToEntity()); } await _twitterService.PostNewJobOpportunity(jobOpportunity, Url); return RedirectToAction(nameof(Detail), new { id = UrlHelperExtensions.SeoUrl(jobOpportunity.Id, jobOpportunity.Title), fromWizard = 1 }); }
public ActionResult Wizard() { var viewModel = new Wizard(); return View(viewModel); }
public static Wizard FromEntity(Core.Domain.JobOpportunity entity) { var wizard = new Wizard() { Id = entity.Id, Title = entity.Title, Category = entity.Category, Description = entity.Description, CompanyName = entity.CompanyName, CompanyUrl = entity.CompanyUrl, CompanyLogoUrl = entity.CompanyLogoUrl, CompanyEmail = entity.CompanyEmail, IsRemote = entity.IsRemote, JobType = entity.JobType, HowToApply = entity.HowToApply, LocationLatitude = entity.JobOpportunityLocation?.Latitude, LocationLongitude = entity.JobOpportunityLocation?.Longitude, LocationName = entity.JobOpportunityLocation?.Name, LocationPlaceId = entity.JobOpportunityLocation?.PlaceId }; if(entity.JoelTest != null) { wizard.HasSourceControl = entity.JoelTest.HasSourceControl; wizard.HasOneStepBuilds = entity.JoelTest.HasOneStepBuilds; wizard.HasDailyBuilds = entity.JoelTest.HasDailyBuilds; wizard.HasBugDatabase = entity.JoelTest.HasBugDatabase; wizard.HasBusFixedBeforeProceding = entity.JoelTest.HasBusFixedBeforeProceding; wizard.HasUpToDateSchedule = entity.JoelTest.HasUpToDateSchedule; wizard.HasSpec = entity.JoelTest.HasSpec; wizard.HasQuiteEnvironment = entity.JoelTest.HasQuiteEnvironment; wizard.HasBestTools = entity.JoelTest.HasBestTools; wizard.HasTesters = entity.JoelTest.HasTesters; wizard.HasWrittenTest = entity.JoelTest.HasWrittenTest; wizard.HasHallwayTests = entity.JoelTest.HasHallwayTests; } return wizard; }
public async Task<ActionResult> Wizard(Wizard model) { if (!ModelState.IsValid) return View(model) .WithError("Han ocurrido errores de validación que no permiten continuar el proceso"); var jobOpportunity = model.ToEntity(); _jobOpportunityService.CreateNewJobOpportunity(jobOpportunity); await _twitterService.PostNewJobOpportunity(jobOpportunity); return RedirectToAction("Detail", new { id = UrlHelperExtensions.SeoUrl(jobOpportunity.Id, jobOpportunity.Title), fromWizard = 1 }); }
public ActionResult Wizard(Wizard model) { if (!ModelState.IsValid) { model.Locations = _locationService.GetAllLocations().ToSelectList(x => x.Id, x => x.Name); ViewBag.ErrorMessage = "Han ocurrido errores de validación que no permiten continuar el proceso"; return View(model); } var entity = model.ToEntity(); _jobOpportunityService.CreateNewJobOpportunity(entity); return RedirectToAction("Detail", new { id = entity.Id, fromWizard = 1 }); }
public ActionResult Wizard() { var viewModel = new Wizard { Locations = _locationService.GetAllLocations().ToSelectList(x => x.Id, x => x.Name) }; return View(viewModel); }