Commit a71fa596 authored by Andres Käver's avatar Andres Käver

bll and services

parent 841acce8
......@@ -9,7 +9,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Domain", "Domain\Domain.csp
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DAL.App.EF", "DAL.App.EF\DAL.App.EF.csproj", "{F4E2CB39-92D5-4D43-8F77-5724AB6889CC}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{106D1228-800C-42DF-84FC-68ED8F992F04}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Solution Items", "_Solution Items", "{106D1228-800C-42DF-84FC-68ED8F992F04}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Contracts.DAL.Base", "Contracts.DAL.Base\Contracts.DAL.Base.csproj", "{09788B7E-B53A-47B2-A90B-C3F58039C304}"
EndProject
......@@ -25,6 +25,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PublicApi.DTO.v1", "PublicA
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Resources", "Resources\Resources.csproj", "{D36017B4-AD71-45DF-8EC6-D9338424EC74}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contracts.BLL.Base", "Contracts.BLL.Base\Contracts.BLL.Base.csproj", "{3D6113A1-56CF-4AAD-98BB-DB7F97B4E809}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BLL.Base", "BLL.Base\BLL.Base.csproj", "{E227C66F-26C8-4F2F-9F5C-333C44BC6220}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DAL", "DAL", "{8B0FADDD-AC52-42E4-BF2D-2C532622DB75}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BLL", "BLL", "{289BD606-7E46-415F-A90D-3D9442113729}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BLL.App", "BLL.App\BLL.App.csproj", "{50EB1C23-3097-46A0-927E-A579447105BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Contracts.BLL.App", "Contracts.BLL.App\Contracts.BLL.App.csproj", "{CEB4B60B-3D45-47D5-9A7F-B38A52314D41}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -71,6 +83,22 @@ Global
{D36017B4-AD71-45DF-8EC6-D9338424EC74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D36017B4-AD71-45DF-8EC6-D9338424EC74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D36017B4-AD71-45DF-8EC6-D9338424EC74}.Release|Any CPU.Build.0 = Release|Any CPU
{3D6113A1-56CF-4AAD-98BB-DB7F97B4E809}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D6113A1-56CF-4AAD-98BB-DB7F97B4E809}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D6113A1-56CF-4AAD-98BB-DB7F97B4E809}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D6113A1-56CF-4AAD-98BB-DB7F97B4E809}.Release|Any CPU.Build.0 = Release|Any CPU
{E227C66F-26C8-4F2F-9F5C-333C44BC6220}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E227C66F-26C8-4F2F-9F5C-333C44BC6220}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E227C66F-26C8-4F2F-9F5C-333C44BC6220}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E227C66F-26C8-4F2F-9F5C-333C44BC6220}.Release|Any CPU.Build.0 = Release|Any CPU
{50EB1C23-3097-46A0-927E-A579447105BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50EB1C23-3097-46A0-927E-A579447105BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50EB1C23-3097-46A0-927E-A579447105BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50EB1C23-3097-46A0-927E-A579447105BE}.Release|Any CPU.Build.0 = Release|Any CPU
{CEB4B60B-3D45-47D5-9A7F-B38A52314D41}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CEB4B60B-3D45-47D5-9A7F-B38A52314D41}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CEB4B60B-3D45-47D5-9A7F-B38A52314D41}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CEB4B60B-3D45-47D5-9A7F-B38A52314D41}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -78,4 +106,15 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {2B72EE9E-EF0D-44AC-987A-F555DCAC3EC1}
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{E227C66F-26C8-4F2F-9F5C-333C44BC6220} = {289BD606-7E46-415F-A90D-3D9442113729}
{3D6113A1-56CF-4AAD-98BB-DB7F97B4E809} = {289BD606-7E46-415F-A90D-3D9442113729}
{E8C4053F-E461-4937-B675-0CD604CB011D} = {8B0FADDD-AC52-42E4-BF2D-2C532622DB75}
{09788B7E-B53A-47B2-A90B-C3F58039C304} = {8B0FADDD-AC52-42E4-BF2D-2C532622DB75}
{F4E2CB39-92D5-4D43-8F77-5724AB6889CC} = {8B0FADDD-AC52-42E4-BF2D-2C532622DB75}
{5264623A-9FF5-421E-81F5-16A7AD3E281B} = {8B0FADDD-AC52-42E4-BF2D-2C532622DB75}
{B01B900B-7340-4E72-B2D2-9E005177F427} = {8B0FADDD-AC52-42E4-BF2D-2C532622DB75}
{50EB1C23-3097-46A0-927E-A579447105BE} = {289BD606-7E46-415F-A90D-3D9442113729}
{CEB4B60B-3D45-47D5-9A7F-B38A52314D41} = {289BD606-7E46-415F-A90D-3D9442113729}
EndGlobalSection
EndGlobal
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=BLL/@EntryIndexedValue">BLL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DAL/@EntryIndexedValue">DAL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=DTO/@EntryIndexedValue">DTO</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=URL/@EntryIndexedValue">URL</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=VM/@EntryIndexedValue">VM</s:String></wpf:ResourceDictionary>
\ No newline at end of file
using System;
using System.Threading.Tasks;
using BLL.App.Services;
using BLL.Base;
using Contracts.BLL.App;
using Contracts.BLL.App.Services;
using Contracts.BLL.Base;
using Contracts.DAL.App;
using DAL.App.EF;
namespace BLL.App
{
public class AppBLL : BaseBLL<IAppUnitOfWork>, IAppBLL
{
public AppBLL(IAppUnitOfWork unitOfWork) : base(unitOfWork)
{
}
public IAnimalService Animals =>
GetService<IAnimalService>(() => new AnimalService(UnitOfWork));
public IOwnerService Owners =>
GetService<IOwnerService>(() => new OwnerService(UnitOfWork));
public IOwnerAnimalService OwnerAnimals =>
GetService<IOwnerAnimalService>(() => new OwnerAnimalService(UnitOfWork));
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\BLL.Base\BLL.Base.csproj" />
<ProjectReference Include="..\Contracts.BLL.App\Contracts.BLL.App.csproj" />
<ProjectReference Include="..\DAL.App.EF\DAL.App.EF.csproj" />
</ItemGroup>
</Project>
using BLL.Base.Mappers;
using BLL.Base.Services;
using Contracts.BLL.App.Services;
using Contracts.BLL.Base.Mappers;
using Contracts.DAL.App;
using Contracts.DAL.App.Repositories;
using Contracts.DAL.Base.Repositories;
using DAL.App.EF;
using Domain;
namespace BLL.App.Services
{
public class AnimalService : BaseEntityService<IAnimalRepository, IAppUnitOfWork, Animal, Animal>, IAnimalService
{
public AnimalService(IAppUnitOfWork unitOfWork)
: base(unitOfWork, new IdentityMapper<Animal, Animal>(), unitOfWork.Animals)
{
}
}
}
\ No newline at end of file
using BLL.Base.Mappers;
using BLL.Base.Services;
using Contracts.BLL.App.Services;
using Contracts.BLL.Base.Mappers;
using Contracts.DAL.App;
using Contracts.DAL.App.Repositories;
using Contracts.DAL.Base.Repositories;
using DAL.App.EF;
using Domain;
namespace BLL.App.Services
{
public class OwnerAnimalService : BaseEntityService<IOwnerAnimalRepository, IAppUnitOfWork, OwnerAnimal, OwnerAnimal>, IOwnerAnimalService
{
public OwnerAnimalService(IAppUnitOfWork unitOfWork)
: base(unitOfWork, new IdentityMapper<OwnerAnimal, OwnerAnimal>(), unitOfWork.OwnerAnimals)
{
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using BLL.Base.Mappers;
using BLL.Base.Services;
using Contracts.BLL.App.Services;
using Contracts.BLL.Base.Mappers;
using Contracts.DAL.App;
using Contracts.DAL.App.Repositories;
using Contracts.DAL.Base;
using Contracts.DAL.Base.Repositories;
using DAL.App.EF;
using Domain;
using PublicApi.DTO.v1;
namespace BLL.App.Services
{
public class OwnerService : BaseEntityService<IOwnerRepository, IAppUnitOfWork, Owner, Owner>, IOwnerService
{
public OwnerService(IAppUnitOfWork unitOfWork)
: base(unitOfWork, new IdentityMapper<Owner, Owner>(), unitOfWork.Owners)
{
}
public async Task<IEnumerable<Owner>> AllAsync(Guid? userId = null) =>
await ServiceRepository.AllAsync(userId);
public async Task<Owner> FirstOrDefaultAsync(Guid id, Guid? userId = null) =>
await ServiceRepository.FirstOrDefaultAsync(id, userId);
public async Task<bool> ExistsAsync(Guid id, Guid? userId = null) =>
await ServiceRepository.ExistsAsync(id, userId);
public async Task DeleteAsync(Guid id, Guid? userId = null) =>
await ServiceRepository.DeleteAsync(id, userId);
public async Task<IEnumerable<OwnerDTO>> DTOAllAsync(Guid? userId = null) =>
await ServiceRepository.DTOAllAsync(userId);
public async Task<OwnerDTO> DTOFirstOrDefaultAsync(Guid id, Guid? userId = null) =>
await ServiceRepository.DTOFirstOrDefaultAsync(id, userId);
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Contracts.BLL.Base\Contracts.BLL.Base.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="9.0.0" />
</ItemGroup>
</Project>
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contracts.BLL.Base;
using Contracts.DAL.Base;
namespace BLL.Base
{
public class BaseBLL<TUnitOfWork> : IBaseBLL
where TUnitOfWork: IBaseUnitOfWork
{
protected readonly TUnitOfWork UnitOfWork;
public BaseBLL(TUnitOfWork unitOfWork)
{
UnitOfWork = unitOfWork;
}
public async Task<int> SaveChangesAsync()
{
return await UnitOfWork.SaveChangesAsync();
}
public int SaveChanges()
{
return UnitOfWork.SaveChanges();
}
private readonly Dictionary<Type, object> _repoCache = new Dictionary<Type, object>();
// Factory method
public TService GetService<TService>(Func<TService> serviceCreationMethod)
{
if (_repoCache.TryGetValue(typeof(TService), out var repo))
{
return (TService) repo;
}
repo = serviceCreationMethod()!;
_repoCache.Add(typeof(TService), repo);
return (TService) repo;
}
}
}
\ No newline at end of file
using AutoMapper;
using Contracts.BLL.Base.Mappers;
namespace BLL.Base.Mappers
{
public class BaseBLLMapper<TInObject, TOutObject> : IBaseBLLMapper<TInObject, TOutObject>
where TInObject : class, new()
where TOutObject : class, new()
{
private readonly IMapper _mapper;
public BaseBLLMapper()
{
_mapper = new MapperConfiguration(config =>
{
config.CreateMap<TInObject, TOutObject>();
config.CreateMap<TOutObject, TInObject>();
}).CreateMapper();
}
public TOutObject Map<TInObject, TOutObject>(TInObject inObject)
where TInObject : class, new()
where TOutObject : class, new()
{
return _mapper.Map<TInObject, TOutObject>(inObject);
}
}
}
\ No newline at end of file
using Contracts.BLL.Base.Mappers;
namespace BLL.Base.Mappers
{
public class IdentityMapper<TInObject, TOutObject> : IBaseBLLMapper<TInObject, TOutObject>
where TInObject : class, new()
where TOutObject : class, new()
{
public TOutObject Map<TInObject, TOutObject>(TInObject inObject)
where TInObject : class, new()
where TOutObject : class, new()
{
return inObject as TOutObject;
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Contracts.BLL.Base.Mappers;
using Contracts.BLL.Base.Services;
using Contracts.DAL.Base;
using Contracts.DAL.Base.Repositories;
namespace BLL.Base.Services
{
public class BaseEntityService<TServiceRepository, TUnitOfWork, TDALEntity, TBLLEntity> : BaseService,
IBaseEntityService<TBLLEntity>
where TBLLEntity : class, IDomainEntity<Guid>, new()
where TDALEntity : class, IDomainEntity<Guid>, new()
where TUnitOfWork : IBaseUnitOfWork
where TServiceRepository : IBaseRepository<TDALEntity>
{
protected readonly TUnitOfWork ServiceUnitOfWork;
private readonly IBaseBLLMapper<TDALEntity, TBLLEntity> _mapper;
protected readonly TServiceRepository ServiceRepository;
public BaseEntityService(TUnitOfWork unitOfWork, IBaseBLLMapper<TDALEntity, TBLLEntity> mapper,
TServiceRepository serviceRepository)
{
ServiceUnitOfWork = unitOfWork;
ServiceRepository = serviceRepository;
_mapper = mapper;
// TODO - NOT POSSIBLE - we have no idea of what DAL actually is.
// we have now BaseRepository implementation - cant call new on it
// or asc for func methodToCreateRepo to create the correct repo
//ServiceRepository = ServiceUnitOfWork.GetRepository<IBaseRepository<TDALEntity>>(methodToCreateRepo);
}
public virtual IEnumerable<TBLLEntity> All() =>
ServiceRepository.All().Select(entity => _mapper.Map<TDALEntity, TBLLEntity>(entity));
public virtual async Task<IEnumerable<TBLLEntity>> AllAsync() =>
(await ServiceRepository.AllAsync()).Select(entity => _mapper.Map<TDALEntity, TBLLEntity>(entity));
public virtual TBLLEntity Find(params object[] id) =>
_mapper.Map<TDALEntity, TBLLEntity>(ServiceRepository.Find(id));
public virtual async Task<TBLLEntity> FindAsync(params object[] id) =>
_mapper.Map<TDALEntity, TBLLEntity>(await ServiceRepository.FindAsync(id));
public virtual TBLLEntity Add(TBLLEntity entity) =>
_mapper.Map<TDALEntity, TBLLEntity>(ServiceRepository.Add(_mapper.Map<TBLLEntity, TDALEntity>(entity)));
public virtual TBLLEntity Update(TBLLEntity entity) =>
_mapper.Map<TDALEntity, TBLLEntity>(ServiceRepository.Update(_mapper.Map<TBLLEntity, TDALEntity>(entity)));
public virtual TBLLEntity Remove(TBLLEntity entity) =>
_mapper.Map<TDALEntity, TBLLEntity>(ServiceRepository.Remove(_mapper.Map<TBLLEntity, TDALEntity>(entity)));
public virtual TBLLEntity Remove(params object[] id) =>
_mapper.Map<TDALEntity, TBLLEntity>(ServiceRepository.Remove(id));
}
}
\ No newline at end of file
using Contracts.BLL.Base.Services;
namespace BLL.Base.Services
{
public class BaseService : IBaseService
{
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Contracts.BLL.Base\Contracts.BLL.Base.csproj" />
<ProjectReference Include="..\Contracts.DAL.App\Contracts.DAL.App.csproj" />
<ProjectReference Include="..\Domain\Domain.csproj" />
</ItemGroup>
</Project>
using System;
using Contracts.BLL.App.Services;
using Contracts.BLL.Base;
namespace Contracts.BLL.App
{
public interface IAppBLL : IBaseBLL
{
public IAnimalService Animals { get; }
public IOwnerService Owners { get; }
public IOwnerAnimalService OwnerAnimals { get; }
}
}
\ No newline at end of file
using Contracts.BLL.Base.Services;
using Contracts.DAL.Base.Repositories;
using Domain;
namespace Contracts.BLL.App.Services
{
public interface IAnimalService : IBaseEntityService<Animal>
{
// TODO: add custom methods
}
}
\ No newline at end of file
using Contracts.BLL.Base.Services;
using Domain;
namespace Contracts.BLL.App.Services
{
public interface IOwnerAnimalService : IBaseEntityService<OwnerAnimal>
{
}
}
\ No newline at end of file
using Contracts.BLL.Base.Services;
using Contracts.DAL.App.Repositories;
using Domain;
namespace Contracts.BLL.App.Services
{
public interface IOwnerService: IOwnerRepository
{
}
}
\ No newline at end of file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Contracts.DAL.Base\Contracts.DAL.Base.csproj" />
</ItemGroup>
</Project>
using System;
using System.Threading.Tasks;
namespace Contracts.BLL.Base
{
public interface IBaseBLL
{
Task<int> SaveChangesAsync();
int SaveChanges();
TService GetService<TService>(Func<TService> serviceCreationMethod);
}
}
\ No newline at end of file
namespace Contracts.BLL.Base.Mappers
{
public interface IBaseBLLMapper<TInObject, TOutObject>
where TOutObject : class, new()
where TInObject : class, new()
{
TOutObject Map<TInObject, TOutObject>(TInObject inObject)
where TOutObject : class, new()
where TInObject : class, new();
}
}
\ No newline at end of file
using System;
using Contracts.DAL.Base;
using Contracts.DAL.Base.Repositories;
namespace Contracts.BLL.Base.Services
{
public interface IBaseService
{
// add common base methods here
}
public interface IBaseEntityService<TBLLEntity> : IBaseService, IBaseRepository<TBLLEntity>
where TBLLEntity : class, IDomainEntity<Guid>, new()
{
}
}
\ No newline at end of file
using System;
using System.Threading.Tasks;
using Contracts.DAL.Base.Repositories;
namespace Contracts.DAL.Base
{
......@@ -7,5 +9,8 @@ namespace Contracts.DAL.Base
//get thing done!
int SaveChanges();
Task<int> SaveChangesAsync();
TRepository GetRepository<TRepository>(Func<TRepository> repoCreationMethod);
}
}
\ No newline at end of file
......@@ -21,7 +21,6 @@ namespace DAL.App.EF
public IAnimalRepository Animals =>
GetRepository<IAnimalRepository>(() => new AnimalRepository(UOWDbContext));
public IOwnerRepository Owners =>
GetRepository<IOwnerRepository>(() => new OwnerRepository(UOWDbContext));
public IOwnerAnimalRepository OwnerAnimals =>
......
......@@ -2,11 +2,12 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contracts.DAL.Base;
using Contracts.DAL.Base.Repositories;
using Microsoft.EntityFrameworkCore;
namespace DAL.Base.EF
{
public class EFBaseUnitOfWork<TDbContext> : BaseUnitOfWork, IBaseUnitOfWork
public class EFBaseUnitOfWork<TDbContext> : BaseUnitOfWork
where TDbContext : DbContext
{
protected TDbContext UOWDbContext;
......@@ -16,16 +17,15 @@ namespace DAL.Base.EF
UOWDbContext = uowDbContext;
}
public int SaveChanges()
public override int SaveChanges()
{
return UOWDbContext.SaveChanges();
}
public async Task<int> SaveChangesAsync()
public override async Task<int> SaveChangesAsync()
{
return await UOWDbContext.SaveChangesAsync();
}
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Contracts.DAL.Base;
using Contracts.DAL.Base.Repositories;
namespace DAL.Base
{
public class BaseUnitOfWork
public abstract class BaseUnitOfWork : IBaseUnitOfWork
{
private readonly Dictionary<Type, object> _repoCache = new Dictionary<Type, object>();
// Factory method
protected TRepository GetRepository<TRepository>(Func<TRepository> repoCreationMethod)
public TRepository GetRepository<TRepository>(Func<TRepository> repoCreationMethod)
{
if (_repoCache.TryGetValue(typeof(TRepository), out var repo))
{
......@@ -19,5 +22,10 @@ namespace DAL.Base
_repoCache.Add(typeof(TRepository), repo);
return (TRepository) repo;
}
public abstract int SaveChanges();
public abstract Task<int> SaveChangesAsync();
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Contracts.DAL.App;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using DAL.App.EF;
using Domain;
using Extensions;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using PublicApi.DTO.v1;
namespace WebApp.ApiControllers
namespace WebApp.ApiControllers._1._0
{
[Route("api/[controller]")]
[ApiController]
[ApiVersion( "1.0" )]
[Route("api/v{version:apiVersion}/[controller]")]
[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
public class AnimalsController : ControllerBase
{
......
using System;
using System.Security.Claims;
using System.Threading.Tasks;
using Domain.Identity;
using Extensions;
......@@ -8,10 +7,11 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace WebApp.ApiControllers.Identity
namespace WebApp.ApiControllers._1._0.Identity
{
[ApiController]
[Route("api/[controller]/[action]")]
[ApiVersion( "1.0" )]
[Route("api/v{version:apiVersion}/[controller]/[action]")]
public class AccountController : ControllerBase
{
private readonly IConfiguration _configuration;
......
......@@ -3,20 +3,20 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Contracts.DAL.App;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using DAL.App.EF;
using Domain;
using Extensions;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;