Exemple #1
0
        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"));
        }
Exemple #3
0
 public void CreateNewJobOpportunity(JobOpportunity jobOpportunity)
 {
     _jobOpportunityRepository.Add(jobOpportunity);
     _jobOpportunityRepository.SaveChanges();
 }