public ActionResult New(NewJobOpportunityViewModel model) { if (!ModelState.IsValid) { LoadLocations(model); ViewBag.ErrorMessage = "Han ocurrido errores de validación que no permiten continuar el proceso"; return(View(model)); } _jobRepository.Add(model.ToEntity()); _uow.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult New(NewJobOpportunityViewModel job) { if (!ModelState.IsValid) { job.Locations = _locationRepository.GetAllLocations(); ViewBag.ErrorMessage = "Han ocurrido errores de validación que no permiten continuar el proceso"; return(View(job)); } _locationRepository.Add(new Location { Name = "Las Guaranas" }); _jobRepository.Add(job.ToEntity()); _uow.SaveChanges(); return(RedirectToAction("Index")); }
public void CreateNewJobOpportunity(JobOpportunity jobOpportunity) { _jobOpportunityRepository.Add(jobOpportunity); _jobOpportunityRepository.SaveChanges(); }