/// <summary>
        /// Deletes jobOffer with given Id
        /// </summary>
        /// <param name="id">Id of the jobOffer to delete</param>
        public async Task <bool> DeleteJobOfferAsync(Guid id)
        {
            using (var uow = UnitOfWorkProvider.Create())
            {
                if (await jobOfferService.GetAsync(id, false) == null)
                {
                    return(false);
                }

                jobOfferService.Delete(id);
                await uow.Commit();

                return(true);
            }
        }
        public async Task <IActionResult> Delete(DeleteJobOfferViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var offer  = _mapper.Map <JobOffer>(model);
            var result = await _jobOfferService.Delete(offer);

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

            return(View("NotFound"));
        }
예제 #3
0
        public async Task <bool> DeleteJobOffer(int entityId, EmployerDto editor)
        {
            using (var uow = UnitOfWorkProvider.Create())
            {
                var jobOffer = await jobOfferService.GetAsync(entityId, false);

                if (jobOffer == null)
                {
                    return(false);
                }

                if (editor.Id != jobOffer.EmployerId)
                {
                    throw new ArgumentException();
                }

                jobOfferService.Delete(entityId);
                await uow.Commit();

                return(true);
            }
        }
 public async Task <ActionResult <JobOfferViewModel> > Delete(Guid Id)
 {
     return(CustomResponse(await _jobOfferService.Delete(Id)));
 }