/// <summary>
 /// Получить список моделей сотрудников
 /// </summary>
 /// <returns> Список моделей сотрудников</returns>
 public async Task <List <EmployeeModel> > GetAllWithDepartment()
 {
     using (IDataConnection connection = _connectionFactory.Create()) {
         return(await connection.From <Employee>()
                .Join(connection.From <Department>(), employee => employee.DepartmentId, department => department.Id, (employee, department) => new EmployeeModel {
             Department = department.Name,
             Address = employee.Address,
             Birthday = employee.Birthday,
             Details = employee.Details,
             Name = employee.Name,
             Patronymic = employee.Patronymic,
             Surname = employee.Surname,
             Id = employee.Id
         })
                .ToListAsync());
     }
 }
示例#2
0
 /// <summary>
 /// Получить список значений таблицы
 /// </summary>
 /// <returns>Список значений</returns>
 public async Task <List <TEntity> > GetAll()
 {
     using (IDataConnection connection = _connectionFactory.Create()) {
         return(await connection.From <TEntity>().ToListAsync());
     }
 }
示例#3
0
 public List <TEntity> GetAll()
 {
     using (IDataConnection connection = _connectionFactory.Create()) {
         return(connection.From <TEntity>().ToList());
     }
 }