public async Task <ISingleResponse <CreateOrderRequest> > GetCreateOrderRequestAsync() { Logger?.LogDebug("{0} has been invoked", nameof(GetCreateOrderRequestAsync)); var response = new SingleResponse <CreateOrderRequest>(); try { // Retrieve customers list response.Model.Customers = await SalesRepository.GetCustomers().ToListAsync(); // Retrieve employees list response.Model.Employees = await HumanResourcesRepository.GetEmployees().ToListAsync(); // Retrieve shippers list response.Model.Shippers = await SalesRepository.GetShippers().ToListAsync(); // Retrieve products list response.Model.Products = await ProductionRepository.GetProducts().ToListAsync(); } catch (Exception ex) { response.SetError(ex, Logger); } return(response); }
public void Test() { using (var db = new HumanResourcesDbContext()) { IHumanResourcesRepository rep = new HumanResourcesRepository(db); var dep = rep.GetTestDepartment(); var deps = new GenericRepository <Department>(db).All(); } }
public void TestForBaseRepo() { var optionsBuilder = new DbContextOptionsBuilder(); //optionsBuilder.UseInternalServiceProvider optionsBuilder.UseSqlServer("Server=.\\sasiad;Database=AdventureWorks2014;Trusted_Connection=True;"); using (var db = new HumanResourcesDbContext()) { var rep = new HumanResourcesRepository(db); var aa = rep.All <Department>(); } }
public async Task <ISingleResponse <Employee> > GetEmployeeAsync(Employee entity) { var response = new SingleResponse <Employee>(); try { response.Model = await HumanResourcesRepository.GetEmployeeAsync(entity); } catch (Exception ex) { response.SetError(ex, Logger); } return(response); }
public async Task <IListModelResponse <Employee> > GetEmployeesAsync(Int32 pageSize = 0, Int32 pageNumber = 0) { Logger?.LogInformation("{0} has been invoked", nameof(GetEmployeesAsync)); var response = new ListModelResponse <Employee>() as IListModelResponse <Employee>; try { response.Model = await HumanResourcesRepository.GetEmployees(pageSize, pageNumber).ToListAsync(); } catch (Exception ex) { response.SetError(ex, Logger); } return(response); }
public async Task <ISingleResponse <Employee> > GetEmployeeAsync(Employee entity) { Logger?.LogInformation("{0} has been invoked", nameof(GetEmployeeAsync)); var response = new SingleResponse <Employee>(); try { response.Model = await HumanResourcesRepository.GetEmployeeAsync(entity); } catch (Exception ex) { response.SetError(ex, Logger); } return(response); }
public async Task <ISingleModelResponse <Employee> > UpdateEmployeeAsync(Employee changes) { Logger?.LogInformation("{0} has been invoked", nameof(UpdateEmployeeAsync)); var response = new SingleModelResponse <Employee>() as ISingleModelResponse <Employee>; try { await HumanResourcesRepository.UpdateEmployeeAsync(changes); response.Model = changes; } catch (Exception ex) { response.SetError(ex, Logger); } return(response); }
public async Task <ISingleResponse <CreateOrderRequest> > GetCreateRequestAsync() { Logger?.LogInformation("{0} has been invoked", nameof(GetCreateRequestAsync)); var response = new SingleResponse <CreateOrderRequest>(); try { response.Model.Customers = (await GetCustomersAsync()).Model; response.Model.Employees = (await HumanResourcesRepository.GetEmployees().ToListAsync()); response.Model.Shippers = (await GetShippersAsync()).Model; response.Model.Products = (await ProductionRepository.GetProducts().ToListAsync()); } catch (Exception ex) { response.SetError(ex, Logger); } return(response); }
public HumanResourcesService(HumanResourcesRepository humanResourcesRepository) { this.humanResourcesRepository = humanResourcesRepository; }