コード例 #1
0
        public ContactListApiModel GetContacts(int accountId, int currentPage, int pageSize, string query)
        {
            var dbContacts = _accountRepository.GetContacts(accountId, currentPage, pageSize, query);
            var apiModel   = new ContactListApiModel();

            apiModel.contacts = dbContacts.contacts.Select(c => new ContactListApiModel.ContactInfo()
            {
                id = c.ID, contactName = c.Name, accountName = c.ACCOUNT.Name, email = c.Email, phone = c.Phone, owner = c.Owner.FirstName + " " + c.Owner.LastName
            }).ToList();
            apiModel.pageInfo = dbContacts.p;
            return(apiModel);
        }
コード例 #2
0
ファイル: CampaignService.cs プロジェクト: auditt98/VaniCRM
        public ContactListApiModel GetContacts(int id, string query = "", int pageSize = 0, int currentPage = 1)
        {
            var dbContacts = _campaignRepository.GetContacts(id, query, pageSize, currentPage);
            var contacts   = new ContactListApiModel();

            contacts.contacts = dbContacts.contacts.Select(c => new ContactListApiModel.ContactInfo()
            {
                id = c.ID, accountName = c.ACCOUNT?.Name, contactName = c.Name, email = c.Email, owner = c.Owner?.Username, phone = c.Phone
            }).ToList();
            contacts.pageInfo = dbContacts.p;
            return(contacts);
        }
コード例 #3
0
ファイル: ContactService.cs プロジェクト: auditt98/VaniCRM
        public ContactListApiModel GetContactList(string query = "", int pageSize = 0, int currentPage = 1, List <string> sort = null)
        {
            var    dbContacts   = _contactRepository.GetAllContacts(query, pageSize, currentPage, sort);
            var    apiModel     = new ContactListApiModel();
            string targetFolder = HttpContext.Current.Server.MapPath("~/Uploads");

            apiModel.contacts = dbContacts.contacts.Select(c => new ContactListApiModel.ContactInfo()
            {
                id = c.ID, contactName = c.Name, accountName = c.ACCOUNT != null ? c.ACCOUNT.Name : "", email = c.Email, phone = c.Phone, owner = c.Owner.Username, avatar = c.Avatar != null ? $"{StaticStrings.ServerHost}avatar?fileName={c.Avatar}" : $"{StaticStrings.ServerHost}avatar?fileName=default.png"
            }).ToList();
            apiModel.pageInfo = dbContacts.p;
            return(apiModel);
        }