Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .vs/AdvancedWebAPI/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified .vs/AdvancedWebAPI/v17/.futdcache.v2
Binary file not shown.
Binary file modified .vs/AdvancedWebAPI/v17/.suo
Binary file not shown.
Binary file modified .vs/ProjectEvaluation/advancedwebapi.metadata.v5.2
Binary file not shown.
Binary file modified .vs/ProjectEvaluation/advancedwebapi.projects.v5.2
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions AWA.Domain/Interfaces/IUnitOfWork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{
public interface IUnitOfWork : IDisposable
{
IBusinessEntityContactRepository BusinessEntityContacts { get; }
IContactTypeRepository ContactTypes { get; }
//IBusinessEntityContactRepository BusinessEntityContacts { get; }
//IContactTypeRepository ContactTypes { get; }
IPersonRepository People { get; }
IEmailAddressRepository EmailAddresses { get; }
IEmployeeRepository Employees { get; }
Expand Down
Binary file modified AWA.Domain/bin/Debug/net7.0/AWA.Domain.dll
Binary file not shown.
Binary file modified AWA.Domain/bin/Debug/net7.0/AWA.Domain.pdb
Binary file not shown.
Binary file not shown.
Binary file modified AWA.Domain/obj/Debug/net7.0/AWA.Domain.dll
Binary file not shown.
Binary file modified AWA.Domain/obj/Debug/net7.0/AWA.Domain.pdb
Binary file not shown.
Binary file modified AWA.Domain/obj/Debug/net7.0/ref/AWA.Domain.dll
Binary file not shown.
Binary file modified AWA.Domain/obj/Debug/net7.0/refint/AWA.Domain.dll
Binary file not shown.
Binary file modified AWA.MinApi/bin/Debug/net7.0/AWA.Domain.dll
Binary file not shown.
Binary file modified AWA.MinApi/bin/Debug/net7.0/AWA.Domain.pdb
Binary file not shown.
Binary file modified AWA.MinApi/bin/Debug/net7.0/AWA.MinApi.dll
Binary file not shown.
Binary file modified AWA.MinApi/bin/Debug/net7.0/AWA.MinApi.pdb
Binary file not shown.
Binary file modified AWA.MinApi/bin/Debug/net7.0/AWA.Repository.dll
Binary file not shown.
Binary file modified AWA.MinApi/bin/Debug/net7.0/AWA.Repository.pdb
Binary file not shown.
Binary file modified AWA.MinApi/bin/Debug/net7.0/AWA.Services.dll
Binary file not shown.
Binary file modified AWA.MinApi/bin/Debug/net7.0/AWA.Services.pdb
Binary file not shown.
Binary file not shown.
Binary file modified AWA.MinApi/obj/Debug/net7.0/AWA.MinApi.dll
Binary file not shown.
Binary file modified AWA.MinApi/obj/Debug/net7.0/AWA.MinApi.pdb
Binary file not shown.
9 changes: 5 additions & 4 deletions AWA.Repository/DependencyInjection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace AWA.Repository
{
public static class DependencyInjection
public static class DependencyInjection
{
public static IServiceCollection AddDIServices(this IServiceCollection services, string connectionString)
{
Expand All @@ -21,11 +21,12 @@ public static IServiceCollection AddDIServices(this IServiceCollection services,
});
services.AddScoped<IUnitOfWork, UnitOfWork>();
//services.AddScoped<IProductRepository, ProductRepository>();
services.AddTransient<IBusinessEntityContactRepository, BusinessEntityContactRepository>();
services.AddTransient<IContactTypeRepository, ContactTypeRepository>();
//services.AddTransient<IBusinessEntityContactRepository, BusinessEntityContactRepository>();
//services.AddTransient<IContactTypeRepository, ContactTypeRepository>();
services.AddTransient<IEmailAddressRepository, EmailAddressRepository>();
services.AddTransient<IPersonRepository, PersonRepository>();

services.AddTransient<IEmployeeRepository, EmployeeRepository>();

return services;
}
}
Expand Down
2 changes: 1 addition & 1 deletion AWA.Repository/EmployeeRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace AWA.Repository
{
internal class EmployeeRepository : GenericRepository<Employee>, IEmployeeRepository
public class EmployeeRepository : GenericRepository<Employee>, IEmployeeRepository
{
public EmployeeRepository(AdventureWorksContext context) : base(context)
{
Expand Down
16 changes: 8 additions & 8 deletions AWA.Repository/UnitOfWork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ public class UnitOfWork : IUnitOfWork

private readonly AdventureWorksContext _dbContext;

public IBusinessEntityContactRepository BusinessEntityContacts { get; }
//public IBusinessEntityContactRepository BusinessEntityContacts { get; }

public IContactTypeRepository ContactTypes { get; }
//public IContactTypeRepository ContactTypes { get; }

public IPersonRepository People { get; }

Expand All @@ -19,18 +19,18 @@ public class UnitOfWork : IUnitOfWork
public IEmployeeRepository Employees { get; }

public UnitOfWork(AdventureWorksContext dbContext,
IBusinessEntityContactRepository businessEntityContactRepository,
IContactTypeRepository contactTypeRepository,
//IBusinessEntityContactRepository businessEntityContactRepository,
//IContactTypeRepository contactTypeRepository,
IPersonRepository personRepository,
IEmailAddressRepository emailAddressRepository,
IEmployeeRepository employee)
IEmployeeRepository employeeRepository)
{
this._dbContext = dbContext;
this.BusinessEntityContacts = businessEntityContactRepository;
this.ContactTypes = contactTypeRepository;
//this.BusinessEntityContacts = businessEntityContactRepository;
//this.ContactTypes = contactTypeRepository;
this.People = personRepository;
this.EmailAddresses = emailAddressRepository;
this.Employees = employee;
this.Employees = employeeRepository;
}

public int Complete()
Expand Down
Binary file modified AWA.Repository/bin/Debug/net7.0/AWA.Domain.dll
Binary file not shown.
Binary file modified AWA.Repository/bin/Debug/net7.0/AWA.Domain.pdb
Binary file not shown.
Binary file modified AWA.Repository/bin/Debug/net7.0/AWA.Repository.dll
Binary file not shown.
Binary file modified AWA.Repository/bin/Debug/net7.0/AWA.Repository.pdb
Binary file not shown.
Binary file not shown.
Binary file modified AWA.Repository/obj/Debug/net7.0/AWA.Repository.dll
Binary file not shown.
Binary file modified AWA.Repository/obj/Debug/net7.0/AWA.Repository.pdb
Binary file not shown.
Binary file modified AWA.Repository/obj/Debug/net7.0/ref/AWA.Repository.dll
Binary file not shown.
Binary file modified AWA.Repository/obj/Debug/net7.0/refint/AWA.Repository.dll
Binary file not shown.
1 change: 0 additions & 1 deletion AWA.Services/DTOPeople.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
public class DTOPeople
{
public int BusinessEntityId { get; internal set; }
public string? Name { get; internal set; }
public string? Title { get; internal set; }
public string? FirstName { get; internal set; }
public string? LastName { get; internal set; }
Expand Down
33 changes: 21 additions & 12 deletions AWA.Services/PersonService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,36 @@ public PersonService(IUnitOfWork unitOfWork)
}
public async Task<IEnumerable<DTOPeople>> GetAllPeople()
{
var businessEntityContact = await _unitOfWork.BusinessEntityContacts.GetAll();
var contactType = await _unitOfWork.ContactTypes.GetAll();
//var businessEntityContact = await _unitOfWork.BusinessEntityContacts.GetAll();
//var contactType = await _unitOfWork.ContactTypes.GetAll();
var people = await _unitOfWork.People.GetAll();
var emailAddress = await _unitOfWork.EmailAddresses.GetAll();
var employees =await _unitOfWork.Employees.GetAll();
var result = (from b in businessEntityContact
join c in contactType on b.ContactTypeId equals c.ContactTypeId
join p in people on b.PersonId equals p.BusinessEntityId
join e in emailAddress on p.BusinessEntityId equals e.BusinessEntityId
var employees = await _unitOfWork.Employees.GetAll();
var result = (from p in people
join em in employees on p.BusinessEntityId equals em.BusinessEntityId
select new DTOPeople { BusinessEntityId = b.BusinessEntityId, Name = c.Name, Title = p.Title, FirstName = p.FirstName, LastName = p.LastName, EmailAddress = e.EmailAddress1,BirthDate=em.BirthDate,JobTitle=em.JobTitle }
join e in emailAddress on p.BusinessEntityId equals e.BusinessEntityId
select new DTOPeople
{
BusinessEntityId = p.BusinessEntityId,
Title = p.Title,
FirstName = p.FirstName,
LastName = p.LastName,
EmailAddress = e.EmailAddress1,
BirthDate = em.BirthDate,
JobTitle = em.JobTitle
}
);
return result;
}



public PagedList<DTOPeople> GetPagedPeople(PersonParameters personParameters)
{
var allPeople = GetAllPeople().Result.AsQueryable<DTOPeople>()
.Where(o => o.BirthDate.Year >= personParameters.MinYearOfBirth && o.BirthDate.Year <= personParameters.MaxYearOfBirth)
.OrderBy(so => so.Name);
return PagedList<DTOPeople>.ToPagedList(allPeople, personParameters.PageNumber, personParameters.PageSize);
var allPeople = GetAllPeople().Result.AsQueryable<DTOPeople>()
.Where(o => o.BirthDate.Year >= personParameters.MinYearOfBirth && o.BirthDate.Year <= personParameters.MaxYearOfBirth)
.OrderBy(so => so.FirstName);
return PagedList<DTOPeople>.ToPagedList(allPeople, personParameters.PageNumber, personParameters.PageSize);
}
}
}
Binary file modified AWA.Services/bin/Debug/net7.0/AWA.Domain.dll
Binary file not shown.
Binary file modified AWA.Services/bin/Debug/net7.0/AWA.Domain.pdb
Binary file not shown.
Binary file modified AWA.Services/bin/Debug/net7.0/AWA.Services.dll
Binary file not shown.
Binary file modified AWA.Services/bin/Debug/net7.0/AWA.Services.pdb
Binary file not shown.
Binary file not shown.
Binary file modified AWA.Services/obj/Debug/net7.0/AWA.Services.dll
Binary file not shown.
Binary file modified AWA.Services/obj/Debug/net7.0/AWA.Services.pdb
Binary file not shown.
Binary file modified AWA.Services/obj/Debug/net7.0/ref/AWA.Services.dll
Binary file not shown.
Binary file modified AWA.Services/obj/Debug/net7.0/refint/AWA.Services.dll
Binary file not shown.