Exemplo n.º 1
0
        public static List <RoleViewModel> SearchStringRoleCode(string prefix)
        {
            List <RoleViewModel> result = new List <RoleViewModel>();

            try
            {
                using (MarkomApplicationDBEntities db = new MarkomApplicationDBEntities())
                {
                    var res = db.spRoleCode(prefix);

                    List <RoleViewModel> roleList = res.Select(c => new RoleViewModel
                    {
                        id   = c.id,
                        code = c.code
                    }).ToList();

                    result = roleList;
                }
            }
            catch (Exception ex)
            {
                Message = ex.Message;
            }
            return(result);
        }