Пример #1
0
        public static List <UnitViewModel> SearchUnitCode(string prefix)
        {
            List <UnitViewModel> result = new List <UnitViewModel>();

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

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

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