public IActionResult Delete(int id)
        {
            Agent abs = _AgentRepository.GetAgentById(id);

            if (abs == null)
            {
                return(NotFound());
            }
            _AgentRepository.DeleteAgent(abs);
            return(RedirectToAction("index"));
        }
        public IActionResult DeleteAgent(int agentId)
        {
            if (!_agentRepo.AgentExists(agentId))
            {
                return(NotFound());
            }

            Agent agent = _agentRepo.GetAgent(agentId);

            if (!_agentRepo.DeleteAgent(agent))
            {
                return(StatusCode(500));
            }

            return(Ok());
        }
        public HttpResponseMessage Delete(int agentId)
        {
            HttpResponseMessage response;

            try
            {
                agentRepository.DeleteAgent(agentId);
                agentRepository.Save();
            }
            catch (Exception ex)
            {
                response = Request.CreateResponse(HttpStatusCode.InternalServerError, "Error");
                return(response);
            }
            response = Request.CreateResponse(HttpStatusCode.OK, "Success");
            return(response);
        }
        public async Task <int> DeleteMerchant([FromBody] int agentRequestID)
        {
            var agentResponse = await _agentRepository.DeleteAgent(agentRequestID);

            return(agentResponse);
        }
Beispiel #5
0
 public void DeleteAgent(int id)
 {
     _agentRepository.DeleteAgent(id);
 }