Example #1
0
        public List <ReferenceData.Entity.Account> SearchAccount(string keyword)
        {
            List <ReferenceData.Entity.Account> list = null;
            var resultSet = db.Usp_SearchAccountByEmailOrName(keyword).ToList();

            if (resultSet.Count > 0)
            {
                string imagesFolder = Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + @"\Files\Images\";
                list = new List <ReferenceData.Entity.Account>();
                foreach (var a in resultSet)
                {
                    ReferenceData.Entity.Account acc = new ReferenceData.Entity.Account();
                    acc.id        = (int)a.id;
                    acc.email     = a.email;
                    acc.password  = a.password;
                    acc.firstName = a.firstName;
                    acc.lastName  = a.lastName;
                    acc.birthday  = a.birthday;
                    acc.createdAt = a.createdAt;
                    acc.avatar    = ChatAppUtils.ConvertFileToByte(imagesFolder + a.avatar);
                    list.Add(acc);
                }
            }
            return(list);
        }