File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 options . UseMySQL ( builder . Configuration . GetConnectionString ( "AZURE_MYSQL_CONNECTIONSTRING" ) )
1616) ;
1717
18- builder . Services . AddScoped < IUnitOfWork , UnitOfWork > ( ) ;
1918builder . Services . AddScoped < IDeviceService , DeviceService > ( ) ;
2019builder . Services . AddScoped < IDeviceModelService , DeviceModelService > ( ) ;
2120builder . Services . AddScoped < IBrandService , BrandService > ( ) ;
Original file line number Diff line number Diff line change 11using TechInventory . Models ;
22using TechInventory . Data . UnitOfWork ;
3+ using TechInventory . Data . Context ;
34using TechInventory . Data . Repository ;
45
56namespace TechInventory . Services . Brand ;
67
7- public class BrandService ( IUnitOfWork unitOfWork ) : IBrandService
8+ public class BrandService : IBrandService
89{
9- private readonly IUnitOfWork _unitOfWork = unitOfWork ;
10- private readonly IRepository < Models . Brand > _repository = unitOfWork . BrandRepository ;
10+ private readonly UnitOfWork _unitOfWork ;
11+ private readonly IRepository < Models . Brand > _repository ;
12+
13+ public BrandService ( InventoryDbContext context )
14+ {
15+ _unitOfWork = new UnitOfWork ( context ) ;
16+ _repository = _unitOfWork . BrandRepository ;
17+ }
1118
1219 public async Task < Result < bool > > CreateBrand ( Models . Brand brand )
1320 {
Original file line number Diff line number Diff line change 11using TechInventory . Models ;
22using TechInventory . Data . Repository ;
33using TechInventory . Data . UnitOfWork ;
4+ using TechInventory . Data . Context ;
45
56namespace TechInventory . Services . Device ;
67
7- public class DeviceService ( IUnitOfWork unitOfWork ) : IDeviceService
8+ public class DeviceService : IDeviceService
89{
9- private readonly IUnitOfWork _unitOfWork = unitOfWork ;
10- private readonly IRepository < Models . Device > _repository = unitOfWork . DeviceRepository ;
11- private readonly IRepository < Models . DeviceModel > _modelRepository = unitOfWork . DeviceModelRepository ;
10+ private readonly UnitOfWork _unitOfWork ;
11+ private readonly IRepository < Models . Device > _repository ;
12+ private readonly IRepository < Models . DeviceModel > _modelRepository ;
13+
14+ public DeviceService ( InventoryDbContext context )
15+ {
16+ _unitOfWork = new UnitOfWork ( context ) ;
17+ _repository = _unitOfWork . DeviceRepository ;
18+ _modelRepository = _unitOfWork . DeviceModelRepository ;
19+ }
1220
1321 public async Task < Result < bool > > AddDevice ( Models . Device device )
1422 {
Original file line number Diff line number Diff line change 11using TechInventory . Data . UnitOfWork ;
22using TechInventory . Data . Repository ;
3+ using TechInventory . Data . Context ;
34using TechInventory . Models ;
45
56namespace TechInventory . Services . DeviceModel ;
67
7- public class DeviceModelService ( IUnitOfWork unitOfWork ) : IDeviceModelService
8+ public class DeviceModelService : IDeviceModelService
89{
9- private readonly IUnitOfWork _unitOfWork = unitOfWork ;
10- private readonly IRepository < Models . DeviceModel > _repository = unitOfWork . DeviceModelRepository ;
11- private readonly IRepository < Models . Brand > _brandRepository = unitOfWork . BrandRepository ;
10+ private readonly UnitOfWork _unitOfWork ;
11+ private readonly IRepository < Models . DeviceModel > _repository ;
12+ private readonly IRepository < Models . Brand > _brandRepository ;
13+
14+ public DeviceModelService ( InventoryDbContext context )
15+ {
16+ _unitOfWork = new UnitOfWork ( context ) ;
17+ _repository = _unitOfWork . DeviceModelRepository ;
18+ _brandRepository = _unitOfWork . BrandRepository ;
19+ }
1220
1321 public async Task < Result < bool > > CreateDeviceModel ( Models . DeviceModel deviceModel )
1422 {
Original file line number Diff line number Diff line change 11using TechInventory . Models ;
22using TechInventory . Data . UnitOfWork ;
3+ using TechInventory . Data . Context ;
34using TechInventory . Data . Repository ;
45
56namespace TechInventory . Services . Maintenance ;
67
7- public class MaintenanceRecordService ( IUnitOfWork unitOfWork ) : IMaintenanceRecordService
8+ public class MaintenanceRecordService : IMaintenanceRecordService
89{
9- private readonly IUnitOfWork _unitOfWork = unitOfWork ;
10- private readonly IRepository < MaintenanceRecord > _repository = unitOfWork . MaintenanceRecordRepository ;
11- private readonly IRepository < Models . Device > _deviceRepository = unitOfWork . DeviceRepository ;
10+ private readonly UnitOfWork _unitOfWork ;
11+ private readonly IRepository < MaintenanceRecord > _repository ;
12+ private readonly IRepository < Models . Device > _deviceRepository ;
13+
14+ public MaintenanceRecordService ( InventoryDbContext context )
15+ {
16+ _unitOfWork = new UnitOfWork ( context ) ;
17+ _repository = _unitOfWork . MaintenanceRecordRepository ;
18+ _deviceRepository = _unitOfWork . DeviceRepository ;
19+ }
1220
1321 public async Task < Result < bool > > CreateRecord ( MaintenanceRecord record )
1422 {
You can’t perform that action at this time.
0 commit comments