Exemple #1
0
        public static async Task <IEnumerable <SelectListItem> > GetListOfUser(IConfiguration configuration)
        {
            UserDetailsRepository    userDetailsRepository = new UserDetailsRepository(configuration);
            List <UserDetailsEntity> userDetailsEntity     = await userDetailsRepository.GeAllUserDetails();

            List <SelectListItem> itemList = new List <SelectListItem>();

            foreach (var item in userDetailsEntity)
            {
                string[] names = item.Name.Split();
                string   name  = names.Count() > 1 ? names[0] + " " + names[1] : null;
                itemList.Add(new SelectListItem()
                {
                    Value = item.EmailId, Text = name
                });
            }
            return(itemList);
        }