コード例 #1
0
        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
            });
        }
コード例 #2
0
        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
            });
        }
コード例 #3
0
 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 });
 }