public async Task <ActionResult <JobOfferViewModel> > Add(JobOfferViewModel jobOfferViewModel)
 {
     if (!ModelState.IsValid)
     {
         return(CustomResponse(ModelState));
     }
     return(CustomResponse(await _jobOfferService.Add(jobOfferViewModel)));
 }
Example #2
0
        public ActionResult Create(JobOfferViewModel model)
        {
            var result = _JobofferService.Add(model.JobOffer);

            if (result.Success)
            {
                return(RedirectToAction("Index", "JobOffer", new { area = "Trainee" }));
            }

            return(Error(result));
        }
        public async Task <IActionResult> Create(CreateJobOfferViewModel model)
        {
            if (!ModelState.IsValid)
            {
                model.JobCategories = await _jobCategoryService.GetAllCategories();

                model.JobTypes = await _jobTypeService.GetAllTypes();

                return(View(model));
            }

            var jobOffer = _mapper.Map <JobOffer>(model);
            var result   = await _jobOfferService.Add(jobOffer);

            if (result)
            {
                return(RedirectToAction(nameof(Index)));
            }

            return(View("NotFound"));
        }