internal HttpResponseMessage Emails(HttpRequestMessage request, EmailDTO cqDTO)
        {
            string key;
            var    aur       = new AppUserRepository();
            var    companyId = 0;
            var    userId    = aur.ValidateUser(cqDTO.Key, out key, ref companyId);

            if (userId > 0)
            {
                var ur = new EmailRepository();
                var u  = new Email();

                var predicate = ur.GetPredicate(cqDTO, u, companyId);
                var data      = ur.GetByPredicate(predicate);
                var col       = new Collection <Dictionary <string, string> >();
                data = data.OrderBy(x => x.EmailAddress).ToList();
                foreach (var item in data)
                {
                    var dic = new Dictionary <string, string>();


                    dic.Add("EmailID", item.EmailID.ToString());
                    dic.Add("EmailAddress", item.EmailAddress);
                    dic.Add("ReceiveDailyReport", item.ReceiveDailyReport.ToString());
                    col.Add(dic);
                    var ufdic = new Dictionary <string, string>();
                }

                var ur2 = new EmailListRepository();
                var u2  = new EmailList();

                var predicate2 = ur2.GetPredicate(cqDTO, u2, companyId);
                var data2      = ur2.GetByPredicate(predicate);
                var col2       = new Collection <Dictionary <string, string> >();
                data2 = data2.OrderBy(x => x.EmailListName).ToList();
                foreach (var item in data2)
                {
                    var dic = new Dictionary <string, string>();


                    dic.Add("EmailListId", item.EmailListId.ToString());
                    dic.Add("EmailListName", item.EmailListName);
                    col2.Add(dic);
                    var ufdic = new Dictionary <string, string>();
                }

                //var ur3 = new ListEmailRepository();
                //var u3 = new ListEmail();

                //var predicate3 = ur3.GetPredicate(cqDTO, u3, companyId);
                //var data3 = ur3.GetByPredicate(predicate);
                //var col3 = new Collection<Dictionary<string, string>>();
                //data3 = data3.ToList();
                //foreach (var item in data3)
                //{

                //    var dic = new Dictionary<string, string>();


                //    dic.Add("ListId", item.ListId.ToString());
                //    dic.Add("EmailId", item.EmailId.ToString());
                //    col3.Add(dic);
                //    var ufdic = new Dictionary<string, string>();


                //}

                var retValList = new List <GenericDTO>();
                var retVal     = new GenericDTO
                {
                    Key        = key,
                    ReturnData = col
                };
                retValList.Add(retVal);
                var retVal2 = new GenericDTO
                {
                    Key        = key,
                    ReturnData = col2
                };
                retValList.Add(retVal2);

                //var retVal3 = new GenericDTO
                //{
                //    Key = key,
                //    ReturnData = col3
                //};
                //retValList.Add(retVal3);

                return(Request.CreateResponse(HttpStatusCode.OK, retValList));
            }
            var message = "validation failed";

            return(request.CreateResponse(HttpStatusCode.NotFound, message));
        }
        internal HttpResponseMessage Emails(HttpRequestMessage request, EmailDTO cqDTO)
        {
            string key;
            var aur = new AppUserRepository();
            var companyId = 0;
            var userId = aur.ValidateUser(cqDTO.Key, out key, ref companyId);
            if (userId > 0)
            {
                var ur = new EmailRepository();
                var u = new Email();

                var predicate = ur.GetPredicate(cqDTO, u, companyId);
                var data = ur.GetByPredicate(predicate);
                var col = new Collection<Dictionary<string, string>>();
                data = data.OrderBy(x => x.EmailAddress).ToList();
                foreach (var item in data)
                {

                    var dic = new Dictionary<string, string>();

                    dic.Add("EmailID", item.EmailID.ToString());
                    dic.Add("EmailAddress", item.EmailAddress);
                    dic.Add("ReceiveDailyReport", item.ReceiveDailyReport.ToString());
                    col.Add(dic);
                    var ufdic = new Dictionary<string, string>();

                }

                var retVal = new GenericDTO
                {
                    Key = key,
                    ReturnData = col
                };
                return Request.CreateResponse(HttpStatusCode.OK, retVal);
            }
            var message = "validation failed";
            return request.CreateResponse(HttpStatusCode.NotFound, message);
        }