public static List <MenuViewModel> SearchMenuStringName(string prefix) { List <MenuViewModel> result = new List <MenuViewModel>(); try { using (MarkomApplicationDBEntities db = new MarkomApplicationDBEntities()) { var res = db.spMenuName(prefix); List <MenuViewModel> nameList = res.Select(c => new MenuViewModel { id = c.id, name = c.name }).ToList(); result = nameList; } } catch (Exception ex) { Message = ex.Message; } return(result); }