示例#1
0
 public IDataModel Read(int id)
 {
     using(var db = new GisDataBase())
     {
         return Mapper.Map<Company,CompanyModel>(db.Companies.FirstOrDefault(x => x.ID == id));
     }
 }
示例#2
0
        public IEnumerable<IDataModel> Read()
        {
            var companies = new List<CompanyModel>();

            using (var db = new GisDataBase())
            {
                companies.AddRange(db.Companies.Select(company => Mapper.Map<Company, CompanyModel>(company)));
            }

            return companies;
        }