public async Task <ActionResult <JobOfferViewModel> > Update(JobOfferViewModel jobOfferViewModel)
 {
     if (!ModelState.IsValid)
     {
         return(CustomResponse(ModelState));
     }
     return(CustomResponse(await _jobOfferService.Update(jobOfferViewModel)));
 }
Beispiel #2
0
        public ActionResult Edit(int id, JobOfferViewModel model)
        {
            var result = _JobofferService.Update(id, model.JobOffer);

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

            return(Error(result));
        }
        /// <summary>
        /// Updates jobOffer
        /// </summary>
        /// <param name="jobOfferDto">JobOffer details</param>
        public async Task <bool> EditJobOfferAsync(JobOfferDto jobOfferDto)
        {
            using (var uow = UnitOfWorkProvider.Create())
            {
                if (await jobOfferService.GetAsync(jobOfferDto.Id, false) == null)
                {
                    return(false);
                }

                await jobOfferService.Update(jobOfferDto);

                await uow.Commit();

                return(true);
            }
        }
        public async Task <bool> EditJobOffer(JobOfferCreateDto jobOffer, EmployerDto editor)
        {
            if (editor.Id != jobOffer.EmployerId)
            {
                throw new ArgumentException();
            }

            using (var uow = UnitOfWorkProvider.Create())
            {
                if ((await jobOfferService.GetAsync(jobOffer.Id, false)) == null)
                {
                    return(false);
                }
                await jobOfferService.Update(jobOffer);

                await uow.Commit();

                return(true);
            }
        }