Exemplo n.º 1
0
 public IDataModel Read(int id)
 {
     using(var db = new GisDataBase())
     {
         return Mapper.Map<Company,CompanyModel>(db.Companies.FirstOrDefault(x => x.ID == id));
     }
 }
Exemplo n.º 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;
        }