Merge pull request 'SES-66 Services' (#14) from SES-66 into master
Reviewed-on: #14
This commit is contained in:
commit
c55f504741
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Base
|
||||||
|
{
|
||||||
|
public interface IServiceBase<TViewModel, TEntity> : IDisposable
|
||||||
|
{
|
||||||
|
IEnumerable<TViewModel> Get();
|
||||||
|
Task<TViewModel> Get(int id);
|
||||||
|
Task<IEnumerable<TEntity>> Get(Expression<Func<TEntity, bool>> expresssion);
|
||||||
|
Task Create(TViewModel viewModel);
|
||||||
|
Task Update(int id, TViewModel viewModel);
|
||||||
|
Task Delete(int id);
|
||||||
|
Task SaveAsync();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,73 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using AutoMapper;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Base
|
||||||
|
{
|
||||||
|
public class ServiceBase<TViewModel, TEntity> : IServiceBase<TViewModel, TEntity> where TEntity : BaseEntity
|
||||||
|
{
|
||||||
|
protected IMapper Mapper { get; private set; }
|
||||||
|
protected IRepository<TEntity> Repository { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
|
public ServiceBase(IMapper mapper, IRepository<TEntity> repository)
|
||||||
|
{
|
||||||
|
Mapper = mapper;
|
||||||
|
Repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual IEnumerable<TViewModel> Get()
|
||||||
|
{
|
||||||
|
var models = Repository.Get();
|
||||||
|
return Mapper.Map<IEnumerable<TViewModel>>(models);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task<TViewModel> Get(int id)
|
||||||
|
{
|
||||||
|
var result = await Repository.Get(id);
|
||||||
|
return Mapper.Map<TViewModel>(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task<IEnumerable<TEntity>> Get(Expression<Func<TEntity, bool>> expression)
|
||||||
|
{
|
||||||
|
var result = await Repository.Get(expression).ToListAsync();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task Create(TViewModel viewModel)
|
||||||
|
{
|
||||||
|
var model = Mapper.Map<TEntity>(viewModel);
|
||||||
|
await Repository.Create(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task Update(int id, TViewModel viewModel)
|
||||||
|
{
|
||||||
|
var model = Mapper.Map<TEntity>(viewModel);
|
||||||
|
model.Id = id;
|
||||||
|
await Repository.Update(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task Delete(int id)
|
||||||
|
{
|
||||||
|
var model = await Repository.Get(id);
|
||||||
|
Repository.Delete(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual async Task SaveAsync()
|
||||||
|
{
|
||||||
|
await Repository.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Dispose()
|
||||||
|
{
|
||||||
|
Repository.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.AlignmentViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IAlignmentService : IServiceBase<AlignmentViewModel, Alignment>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.BackgroundViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IBackgroundService : IServiceBase<BackgroundViewModel, Background>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.BiographyViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IBiographyService : IServiceBase<BiographyViewModel, Biography>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.CharacterViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICharacterService : IServiceBase<CharacterViewModel, Character>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.CharismaViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICharismaService : IServiceBase<CharismaViewModel, Charisma>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.ClassViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IClassService : IServiceBase<ClassViewModel, Class>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.ConstitutionViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IConstitutionService : IServiceBase<ConstitutionViewModel, Constitution>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.DexterityViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IDexterityService : IServiceBase<DexterityViewModel, Dexterity>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.IntelligenceViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IIntelligenceService : IServiceBase<IntelligenceViewModel, Intelligence>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.RaceViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IRaceService : IServiceBase<RaceViewModel, Race>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.StatisticsViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IStatisticsService : IServiceBase<StatisticsViewModel, Statistics>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.StrengthViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IStrengthService : IServiceBase<StrengthViewModel, Strength>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.UserViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IUserService : IServiceBase<UserViewModel, User>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.WisdomViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IWisdomService : IServiceBase<WisdomViewModel, Wisdom>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.AlignmentViewModels;
|
||||||
|
using AutoMapper;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class AlignmentService : ServiceBase<AlignmentViewModel, Alignment>, IAlignmentService
|
||||||
|
{
|
||||||
|
public AlignmentService(IMapper mapper, IRepository<Alignment> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.BackgroundViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class BackgroundServices : ServiceBase<BackgroundViewModel, Background>, IBackgroundService
|
||||||
|
{
|
||||||
|
public BackgroundServices(IMapper mapper, IRepository<Background> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.BiographyViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class BiographyService : ServiceBase<BiographyViewModel, Biography>, IBiographyService
|
||||||
|
{
|
||||||
|
public BiographyService(IMapper mapper, IRepository<Biography> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.CharacterViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore.Internal;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using AutoMapper.QueryableExtensions;
|
||||||
|
using System.IO;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class CharacterService : ServiceBase<CharacterViewModel, Character>, ICharacterService
|
||||||
|
{
|
||||||
|
public CharacterService(IMapper mapper, IRepository<Character> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.CharismaViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class CharismaService : ServiceBase<CharismaViewModel, Charisma>, ICharismaService
|
||||||
|
{
|
||||||
|
public CharismaService(IMapper mapper, IRepository<Charisma> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.ClassViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class ClassService : ServiceBase<ClassViewModel, Class>, IClassService
|
||||||
|
{
|
||||||
|
public ClassService(IMapper mapper, IRepository<Class> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.ConstitutionViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class ConstitutionService : ServiceBase<ConstitutionViewModel, Constitution>, IConstitutionService
|
||||||
|
{
|
||||||
|
public ConstitutionService(IMapper mapper, IRepository<Constitution> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.DexterityViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class DexterityService : ServiceBase<DexterityViewModel, Dexterity>, IDexterityService
|
||||||
|
{
|
||||||
|
public DexterityService(IMapper mapper, IRepository<Dexterity> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.IntelligenceViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class IntelligenceService : ServiceBase<IntelligenceViewModel, Intelligence>, IIntelligenceService
|
||||||
|
{
|
||||||
|
public IntelligenceService(IMapper mapper, IRepository<Intelligence> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.RaceViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class RaceService : ServiceBase<RaceViewModel, Race>, IRaceService
|
||||||
|
{
|
||||||
|
public RaceService(IMapper mapper, IRepository<Race> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.StatisticsViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class StatisticsService : ServiceBase<StatisticsViewModel, Statistics>, IStatisticsService
|
||||||
|
{
|
||||||
|
public StatisticsService(IMapper mapper, IRepository<Statistics> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.StrengthViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class StrengthService : ServiceBase<StrengthViewModel, Strength>, IStrengthService
|
||||||
|
{
|
||||||
|
public StrengthService(IMapper mapper, IRepository<Strength> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.UserViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Linq;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class UserService : ServiceBase<UserViewModel, User>, IUserService
|
||||||
|
{
|
||||||
|
public UserService(IMapper mapper, IRepository<User> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.WisdomViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class WisdomService : ServiceBase<WisdomViewModel, Wisdom>, IWisdomService
|
||||||
|
{
|
||||||
|
public WisdomService(IMapper mapper, IRepository<Wisdom> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SessionCompanion.Database\SessionCompanion.Database.csproj" />
|
||||||
|
<ProjectReference Include="..\SessionCompanion.ViewModels\SessionCompanion.ViewModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SessionCompanion", "Session
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SessionCompanion.Database", "SessionCompanion.Database\SessionCompanion.Database.csproj", "{CA05189B-A4AB-4946-80DC-EFA075A10F09}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SessionCompanion.Database", "SessionCompanion.Database\SessionCompanion.Database.csproj", "{CA05189B-A4AB-4946-80DC-EFA075A10F09}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SessionCompanion.ViewModels", "SessionCompanion.ViewModels\SessionCompanion.ViewModels.csproj", "{7762AA75-7B60-4F28-B80A-B03E39140F89}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SessionCompanion.ViewModels", "SessionCompanion.ViewModels\SessionCompanion.ViewModels.csproj", "{7762AA75-7B60-4F28-B80A-B03E39140F89}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SessionCompanion.Services", "SessionCompanion.Services\SessionCompanion.Services.csproj", "{C0A172ED-0F4C-4E78-8B64-28E2A756F62F}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -27,6 +29,10 @@ Global
|
|||||||
{7762AA75-7B60-4F28-B80A-B03E39140F89}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{7762AA75-7B60-4F28-B80A-B03E39140F89}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{7762AA75-7B60-4F28-B80A-B03E39140F89}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{7762AA75-7B60-4F28-B80A-B03E39140F89}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{7762AA75-7B60-4F28-B80A-B03E39140F89}.Release|Any CPU.Build.0 = Release|Any CPU
|
{7762AA75-7B60-4F28-B80A-B03E39140F89}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C0A172ED-0F4C-4E78-8B64-28E2A756F62F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C0A172ED-0F4C-4E78-8B64-28E2A756F62F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C0A172ED-0F4C-4E78-8B64-28E2A756F62F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C0A172ED-0F4C-4E78-8B64-28E2A756F62F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.Services.Services;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Configurations
|
||||||
|
{
|
||||||
|
public static class ServiceConfiguration
|
||||||
|
{
|
||||||
|
public static IServiceCollection AddServices(this IServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddScoped<IAlignmentService, AlignmentService>();
|
||||||
|
services.AddScoped<IBackgroundService, BackgroundServices>();
|
||||||
|
services.AddScoped<IBiographyService, BiographyService>();
|
||||||
|
services.AddScoped<ICharacterService, CharacterService>();
|
||||||
|
services.AddScoped<ICharismaService, CharismaService>();
|
||||||
|
services.AddScoped<IClassService, ClassService>();
|
||||||
|
services.AddScoped<IConstitutionService, ConstitutionService>();
|
||||||
|
services.AddScoped<IDexterityService, DexterityService>();
|
||||||
|
services.AddScoped<IIntelligenceService, IntelligenceService>();
|
||||||
|
services.AddScoped<IRaceService, RaceService>();
|
||||||
|
services.AddScoped<IStatisticsService, StatisticsService>();
|
||||||
|
services.AddScoped<IStrengthService, StrengthService>();
|
||||||
|
services.AddScoped<IUserService, UserService>();
|
||||||
|
services.AddScoped<IWisdomService, WisdomService>();
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SessionCompanion.Database\SessionCompanion.Database.csproj" />
|
<ProjectReference Include="..\SessionCompanion.Database\SessionCompanion.Database.csproj" />
|
||||||
|
<ProjectReference Include="..\SessionCompanion.Services\SessionCompanion.Services.csproj" />
|
||||||
<ProjectReference Include="..\SessionCompanion.ViewModels\SessionCompanion.ViewModels.csproj" />
|
<ProjectReference Include="..\SessionCompanion.ViewModels\SessionCompanion.ViewModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ namespace SessionCompanion
|
|||||||
options.UseSqlServer(
|
options.UseSqlServer(
|
||||||
Configuration.GetConnectionString("DefaultConnection")));
|
Configuration.GetConnectionString("DefaultConnection")));
|
||||||
services.AddRepositories();
|
services.AddRepositories();
|
||||||
|
services.AddServices();
|
||||||
services.AddSignalR();
|
services.AddSignalR();
|
||||||
// In production, the Angular files will be served from this directory
|
// In production, the Angular files will be served from this directory
|
||||||
services.AddSpaStaticFiles(configuration =>
|
services.AddSpaStaticFiles(configuration =>
|
||||||
|
Loading…
Reference in New Issue
Block a user