コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Applicant applicant = _repository.GetApplicant(id);

            _repository.DeleteApplicant(applicant);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public async Task <IActionResult> DeleteApplicant(int id)
        {
            var applicant = await _applicantRepository.DeleteApplicant(id);

            if (applicant > 0)
            {
                return(Ok("Deleted"));
            }
            else
            {
                return(BadRequest());
            }
        }
コード例 #3
0
 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);
        }
コード例 #5
0
        public IActionResult DeleteApplicant([FromRoute] string id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            _context.DeleteApplicant(id);

            return(new OkResult());
        }
コード例 #6
0
        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!"));
            }
        }
コード例 #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)));
            }
        }
コード例 #8
0
 public async Task DeleteApplicant(long id)
 {
     await _repository.DeleteApplicant(id);
 }
コード例 #9
0
ファイル: Manager.cs プロジェクト: dwachtel10/SWCProjects
        public void DeleteApplicant(Applicant applicant)
        {
            IApplicantRepository repo = RepoFactory.CreateApplicantRepository();

            repo.DeleteApplicant(applicant);
        }
 public int DeleteApplicant(int applicantID)
 {
     return(_applicantRepository.DeleteApplicant(applicantID));
 }
コード例 #11
0
 public ReturnCode DeleteApplicant(int id)
 {
     return(_applicantRepository.DeleteApplicant(id));
 }