Ejemplo n.º 1
0
        public async Task <ResponseMessagesDto> DeleteApplicant(ApplicantDto applicantDto)
        {
            try
            {
                await _applicantRepository.Delete(new Applicant()
                {
                    Id = applicantDto.Id
                });

                return(new ResponseMessagesDto()
                {
                    Id = applicantDto.Id,
                    SuccessMessage = "Successfully Deleted",
                    Success = true,
                    Error = false
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(new ResponseMessagesDto()
                {
                    Id = 0,
                    FailureMessage = "Failed To Delete",
                    Success = false,
                    Error = true,
                    ExceptionMessage = e.InnerException != null ? e.InnerException.Message : e.Message
                });
            }
        }
Ejemplo n.º 2
0
 public Applicant Delete(int id)
 {
     try
     {
         return(_applicantRepository.Delete(id).Result);
     }
     catch (Exception e)
     {
         throw;
     }
 }
        public Task <Result <Applicant> > RemoveApplicant(int applicantId)
        => TryCatch(async() =>
        {
            var applicant = await _applicantRepository.FindById(applicantId);
            if (applicant == null)
            {
                return(Result.Failure <Applicant>($"applicant {applicantId} not found!"));
            }

            await _applicantRepository.Delete(applicant);
            return(Result.Success(applicant));
        });
Ejemplo n.º 4
0
 public int Delete(int id)
 {
     try
     {
         _repository.Delete(id);
     }
     catch (Exception e)
     {
         _logger.LogError(e.Message);
         throw;
     }
     return(id);
 }
Ejemplo n.º 5
0
        public void Delete(int id)
        {
            if (id == 0)
            {
                throw new Exception(string.Format("Invalid applicant id supplied: {0}", id));
            }

            Applicant dupApplicant = _ApplicantRepository.GetById(id);

            if (dupApplicant == null)
            {
                throw new Exception(string.Format("No applicant has been found by this id : {0}", id));
            }

            _ApplicantRepository.Delete(id);
        }
        public async Task <IActionResult> Delete(int id)
        {
            _logger.LogInformation("DELETE applicants/" + id);
            SetRepoEndpoint();

            var model = await _repo.GetSingleByIdAsync(id, HttpContext.RequestAborted, trackChanges : true);

            if (model == null)
            {
                return(NotFound());
            }

            _repo.Delete(model);
            await _repo.SaveUnitOfWorkAsync(HttpContext.RequestAborted);

            return(Ok());
        }
        public async Task <IActionResult> Delete(int id)
        {
            var thisApplicant = await _repo.Get(id);

            if (thisApplicant == null)
            {
                return(BadRequest("Applicant not found"));
            }

            _repo.Delete(thisApplicant);

            if (await _repo.SaveAll())
            {
                return(NoContent());
            }

            return(BadRequest("Delete unsuccessful"));
        }
        public async Task Delete(ApplicantDelete applicantDelete)
        {
            ApplicantDeleteValidator applicantDeleteValidator = new ApplicantDeleteValidator();

            ValidationResult results = await applicantDeleteValidator.ValidateAsync(applicantDelete);

            if (!results.IsValid)
            {
                foreach (var failure in results.Errors)
                {
                    throw new Exception("Property " + failure.PropertyName + " failed validation. Error was: " +
                                        failure.ErrorMessage);
                }
            }

            try
            {
                await _applicantRepository.Delete(_mapper.Map <Applicant>(applicantDelete));
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            await arepo.Delete(id);

            return(RedirectToAction("Index", "Manage"));
        }
 public async Task DeleteApplicant(int id)
 {
     await _applicantrepository.Delete(id);
 }
 public Task <bool> Delete(int id)
 {
     _logger.LogInformation("Executing {0} service method for applicant {1}.", nameof(Delete), id);
     return(_repository.Delete(id));
 }
        public void Delete(int entityId)
        {
            var entity = _repository.GetById(entityId);

            _repository.Delete(entity);
        }
Ejemplo n.º 13
0
 public async Task <bool> Delete(int id)
 {
     return(await _applicantRepository.Delete(id));
 }
Ejemplo n.º 14
0
        public async Task <bool> Delete(int Id)
        {
            var success = await _repository.Delete(Id);

            return(success);
        }
        public async Task <IActionResult> Delete(int id)
        {
            var result = await _repository.Delete(id);

            return(new JsonResult(result));
        }
Ejemplo n.º 16
0
        public async Task <bool> Delete(int applicantId)
        {
            var success = await _repository.Delete(applicantId).ConfigureAwait(false);

            return(success);
        }