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

            if (abs == null)
            {
                return(NotFound());
            }
            _AgentRepository.DeleteAgent(abs);
            return(RedirectToAction("index"));
        }
示例#2
0
        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);
        }
示例#4
0
        public async Task <int> DeleteMerchant([FromBody] int agentRequestID)
        {
            var agentResponse = await _agentRepository.DeleteAgent(agentRequestID);

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