예제 #1
0
 public IList <PersonListModel> GetAll()
 {
     using (var dbContext = _dbContextSqlFactory.CreateDbContext())
     {
         return(dbContext.People
                .Select(e => PersonMapper.MapPersonEntityToListModel(e))
                .ToList());
     }
 }
예제 #2
0
 public PersonListModel GetByIdListModel(Guid id)
 {
     using (var dbContext = _dbContextSqlFactory.CreateDbContext())
     {
         var entity = dbContext.People.FirstOrDefault(t => t.Id == id);
         if (entity == null)
         {
             return(null);
         }
         return(PersonMapper.MapPersonEntityToListModel(entity));
     }
 }