Esempio n. 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Applicant applicant = _repository.GetApplicant(id);

            _repository.DeleteApplicant(applicant);
            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public async Task <IActionResult> DeleteApplicant(int id)
        {
            var applicant = await _applicantRepository.DeleteApplicant(id);

            if (applicant > 0)
            {
                return(Ok("Deleted"));
            }
            else
            {
                return(BadRequest());
            }
        }
 public IActionResult Delete(int id)
 {
     try
     {
         _repo.DeleteApplicant(id);
         _message = $"Applicant deleted succesfully";
         _logger.LogInformation(_message);
         return(Ok(_message));
     }
     catch (Exception ex)
     {
         _logger.LogInformation($"Failed to delete applicant,Error {ex.Message}");
         return(BadRequest(ex.Message));
     }
 }
        public Response DeleteApplicantById(int id)
        {
            Response response  = _utilities.InitializeResponse();
            var      applicant = _applicantRepository.GetApplicantByID(id);

            if (applicant == null)
            {
                return(_utilities.UnsuccessfulResponse(response, "Invalid id supplied. Could not match applicant to id"));
            }

            _applicantRepository.DeleteApplicant(id);
            _applicantRepository.Save();
            _logger.LogInformation($"Successfully deleted applicant {id}");

            return(response);
        }
        public IActionResult DeleteApplicant([FromRoute] string id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (!ApplicantExists(id))
            {
                return(NotFound());
            }

            _context.DeleteApplicant(id);

            return(new OkResult());
        }
        public async Task <ActionResult <Applicant> > DeleteApplicant(int ID)
        {
            try
            {
                var applicantToDelete = await applicantRepository.GetApplicant(ID);

                if (applicantToDelete == null)
                {
                    return(NotFound($"Applicant with id = {ID} not found"));
                }

                return(await applicantRepository.DeleteApplicant(ID));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError, "Deleting applicant error!"));
            }
        }
Esempio n. 7
0
        public async Task <IActionResult> DeleteApplicant(int Id)
        {
            _logger.LogInformation("\t\n\n=========================================================================\n\nAccessing the Endpoint for Deleting an Applicant");

            try
            {
                var deletionResult = await _appRepository.DeleteApplicant(Id);

                if (deletionResult > 0)
                {
                    _logger.LogInformation("Successful Delete call was made");
                    return(Ok(new ResponseModel(200, "Success", null)));
                }
                _logger.LogInformation("Delete call was not successful");
                return(NotFound(new ResponseModel(404, "Applicant does not exist", null)));
            }
            catch (Exception ex)
            {
                _logger.LogInformation("An Error occured in the Delete endpoint", ex);
                return(BadRequest(new ResponseModel(400, "Some Error occuredl!!! Please Try again", null)));
            }
        }
Esempio n. 8
0
 public async Task DeleteApplicant(long id)
 {
     await _repository.DeleteApplicant(id);
 }
Esempio n. 9
0
        public void DeleteApplicant(Applicant applicant)
        {
            IApplicantRepository repo = RepoFactory.CreateApplicantRepository();

            repo.DeleteApplicant(applicant);
        }
 public int DeleteApplicant(int applicantID)
 {
     return(_applicantRepository.DeleteApplicant(applicantID));
 }
Esempio n. 11
0
 public ReturnCode DeleteApplicant(int id)
 {
     return(_applicantRepository.DeleteApplicant(id));
 }