Example #1
0
        public string LoadAgentList([FromBody] AgentFilter obj)
        {
            var    data     = _businessEntitiesService.GetAllAgents(obj);
            string response = JsonConvert.SerializeObject(data);

            return(response);
        }
        public List <BusinessEntities> GetAllAgents(AgentFilter obj)
        {
            string condition = string.Empty;

            if (!string.IsNullOrEmpty(obj.Code))
            {
                var searchParamCode = "Code='" + obj.Code + "'";
                condition += string.IsNullOrEmpty(condition) ? searchParamCode : " && " + searchParamCode;
            }
            if (!string.IsNullOrEmpty(obj.Name))
            {
                var searchParamCode = "Name Like '%" + obj.Name + "%'";
                condition += string.IsNullOrEmpty(condition) ? searchParamCode : " && " + searchParamCode;
            }
            return(_repositoryBusinessEntities.GetAllByConditions(condition).ToList());
        }