예제 #1
0
        public LeadListApiModel GetLeads(int id, string query = "", int pageSize = 0, int currentPage = 1)
        {
            var dbLeads = _campaignRepository.GetLeads(id, query, pageSize, currentPage);
            var leads   = new LeadListApiModel();

            leads.leads = dbLeads.leads.Select(c => new LeadListApiModel.LeadInfo()
            {
                id = c.ID, companyName = c.CompanyName, email = c.Email, leadOwner = c.Owner?.Username, leadSource = c.LEAD_SOURCE?.Name, name = c.Name, phone = c.Phone, priority = c.PRIORITY?.Name
            }).ToList();
            leads.pageInfo = dbLeads.p;
            return(leads);
        }
예제 #2
0
        public LeadListApiModel GetLeadList(string query = "", int pageSize = 0, int currentPage = 1, List <string> sort = null)
        {
            var    dbLeads      = _leadRepository.GetAllLeads(query, pageSize, currentPage, sort);
            var    apiModel     = new LeadListApiModel();
            string targetFolder = HttpContext.Current.Server.MapPath("~/Uploads");

            apiModel.leads = dbLeads.leads.Select(c => new LeadListApiModel.LeadInfo()
            {
                id = c.ID, name = c.Name, companyName = c.CompanyName, email = c.Email, phone = c.Phone, leadSource = c.LEAD_SOURCE != null ? c.LEAD_SOURCE.Name : "", leadOwner = c.Owner?.Username, priority = c.PRIORITY != null ? c.PRIORITY.Name : "", leadStatus = c.Status != null ? c.Status.Name : "", isConverted = c.Status != null ? c.Status.Name == "Converted" : false, avatar = c.Avatar != null ? $"{StaticStrings.ServerHost}avatar?fileName={c.Avatar}" : $"{StaticStrings.ServerHost}avatar?fileName=default.png"
            }).ToList();

            apiModel.pageInfo = dbLeads.p;
            return(apiModel);
        }