Merge pull request 'SES-119 Added items tables' (#42) from SES-119 into dev
Reviewed-on: #42
This commit is contained in:
commit
c793c99811
@ -24,6 +24,12 @@ namespace SessionCompanion.Database
|
|||||||
public virtual DbSet<Strength> Strengths { get; set; }
|
public virtual DbSet<Strength> Strengths { get; set; }
|
||||||
public virtual DbSet<User> Users { get; set; }
|
public virtual DbSet<User> Users { get; set; }
|
||||||
public virtual DbSet<Wisdom> Wisdoms { get; set; }
|
public virtual DbSet<Wisdom> Wisdoms { get; set; }
|
||||||
|
public virtual DbSet<Armor> Armors { get; set; }
|
||||||
|
public virtual DbSet<CharacterArmor> CharacterArmors { get; set; }
|
||||||
|
public virtual DbSet<Weapon> Weapons { get; set; }
|
||||||
|
public virtual DbSet<CharacterWeapon> CharacterWeapons { get; set; }
|
||||||
|
public virtual DbSet<OtherEquipment> OtherEquipment { get; set; }
|
||||||
|
public virtual DbSet<CharacterOtherEquipment> CharacterOtherEquipment { get; set; }
|
||||||
|
|
||||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }
|
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) { }
|
||||||
|
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
|
||||||
|
public class ArmorRepository : Repository<Armor>, IRepository<Armor>
|
||||||
|
{
|
||||||
|
public ArmorRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
|
||||||
|
public class CharacterArmorRepository : Repository<CharacterArmor>, IRepository<CharacterArmor>
|
||||||
|
{
|
||||||
|
public CharacterArmorRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
|
||||||
|
public class CharacterOtherEquipmentRepository : Repository<CharacterOtherEquipment>, IRepository<CharacterOtherEquipment>
|
||||||
|
{
|
||||||
|
public CharacterOtherEquipmentRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class CharacterWeaponRepository: Repository<CharacterWeapon>, IRepository<CharacterWeapon>
|
||||||
|
{
|
||||||
|
public CharacterWeaponRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
|
||||||
|
public class OtherEquipmentRepository : Repository<OtherEquipment>, IRepository<OtherEquipment>
|
||||||
|
{
|
||||||
|
public OtherEquipmentRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Repositories
|
||||||
|
{
|
||||||
|
public class WeaponRepository : Repository<Weapon>, IRepository<Weapon>
|
||||||
|
{
|
||||||
|
public WeaponRepository(ApplicationDbContext _dbContext) : base(_dbContext)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -17,4 +17,8 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\SessionCompanion.ViewModels\SessionCompanion.ViewModels.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
21
SessionCompanion/SessionCompanion.Database/Tables/Armor.cs
Normal file
21
SessionCompanion/SessionCompanion.Database/Tables/Armor.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
using SessionCompanion.ViewModels.Enums;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
|
||||||
|
public class Armor : BaseEntity
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Category { get; set; }
|
||||||
|
public string ArmorClassBase {get; set; }
|
||||||
|
public bool HaveDexterityBonus { get; set; }
|
||||||
|
public int? MinimumStrength { get; set; }
|
||||||
|
public bool HaveStealthDisadvantage { get; set; }
|
||||||
|
public int Weight { get; set; }
|
||||||
|
public int Cost { get; set; }
|
||||||
|
public CurrencyType CurrencyType { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<CharacterArmor> CharacterArmors { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
public class CharacterArmor : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Character))]
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public virtual Character Character { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(Armor))]
|
||||||
|
public int ArmorId { get; set; }
|
||||||
|
public virtual Armor Armor { get; set; }
|
||||||
|
|
||||||
|
public bool InUse { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
public class CharacterOtherEquipment : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Character))]
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public virtual Character Character { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(OtherEquipment))]
|
||||||
|
public int OtherEquipmentId { get; set; }
|
||||||
|
public virtual OtherEquipment OtherEquipment { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class CharacterWeapon : BaseEntity
|
||||||
|
{
|
||||||
|
[ForeignKey(nameof(Character))]
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public virtual Character Character { get; set; }
|
||||||
|
|
||||||
|
[ForeignKey(nameof(Weapon))]
|
||||||
|
public int WeaponId { get; set; }
|
||||||
|
public virtual Weapon Weapon { get; set; }
|
||||||
|
|
||||||
|
public bool InUse { get; set; }
|
||||||
|
|
||||||
|
public bool HoldInRightHand { get; set; }
|
||||||
|
public bool HoldInLeftHand { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using SessionCompanion.ViewModels.Enums;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
|
||||||
|
public class OtherEquipment : BaseEntity
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public int Cost { get; set; }
|
||||||
|
public CurrencyType CurrencyType { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<CharacterOtherEquipment> CharacterOtherEquipments { get; set; }
|
||||||
|
}
|
||||||
|
}
|
29
SessionCompanion/SessionCompanion.Database/Tables/Weapon.cs
Normal file
29
SessionCompanion/SessionCompanion.Database/Tables/Weapon.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
using SessionCompanion.ViewModels.Enums;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database.Tables
|
||||||
|
{
|
||||||
|
public class Weapon : BaseEntity
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public int Cost { get; set; }
|
||||||
|
public int Weight { get; set; }
|
||||||
|
|
||||||
|
public CurrencyType CurrencyType { get; set; }
|
||||||
|
public int DiceCount { get; set; }
|
||||||
|
public int DiceValue { get; set; }
|
||||||
|
public int? TwoHandDiceCount { get; set; }
|
||||||
|
public int? TwoHandDiceValue { get; set; }
|
||||||
|
public string TwoHandDamageType { get; set; }
|
||||||
|
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
public string WeaponType { get; set; }
|
||||||
|
public int RangeMeele { get; set; }
|
||||||
|
public int? RangeThrowNormal { get; set; }
|
||||||
|
public int? RangeThrowLong { get; set; }
|
||||||
|
public int? RangeLong { get; set; }
|
||||||
|
|
||||||
|
public virtual ICollection<CharacterWeapon> CharacterWeapons { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.ArmorViewModels;
|
||||||
|
|
||||||
|
public interface IArmorService : IServiceBase<ArmorViewModel, Armor>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.CharacterArmorViewModels;
|
||||||
|
|
||||||
|
public interface ICharacterArmorService : IServiceBase<CharacterArmorViewModel, CharacterArmor>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.CharacterOtherEquipmentViewModels;
|
||||||
|
|
||||||
|
public interface ICharacterOtherEquipmentService : IServiceBase<CharacterOtherEquipmentViewModel, CharacterOtherEquipment>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.CharacterWeaponViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface ICharacterWeaponService : IServiceBase<CharacterWeaponViewModel, CharacterWeapon>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.OtherEquipmentViewModels;
|
||||||
|
|
||||||
|
public interface IOtherEquipmentService : IServiceBase<OtherEquipmentViewModel, OtherEquipment>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.ViewModels.WeaponViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IWeaponService : IServiceBase<WeaponViewModel, Weapon>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.ArmorViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class ArmorProfile : Profile
|
||||||
|
{
|
||||||
|
public ArmorProfile()
|
||||||
|
{
|
||||||
|
CreateMap<Armor, ArmorViewModel>().ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
using AutoMapper;
|
||||||
|
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.CharacterArmorViewModels;
|
||||||
|
|
||||||
|
public class CharacterArmorsProfile : Profile
|
||||||
|
{
|
||||||
|
public CharacterArmorsProfile()
|
||||||
|
{
|
||||||
|
CreateMap<CharacterArmorViewModel, CharacterArmor>().ReverseMap();
|
||||||
|
|
||||||
|
CreateMap<CharacterArmor, CharacterArmorViewModelDetails>()
|
||||||
|
.ForMember(vm => vm.Name, conf => conf.MapFrom(armor => armor.Armor.Name.ToString()))
|
||||||
|
.ForMember(vm => vm.Category, conf => conf.MapFrom(armor => armor.Armor.Category.ToString()))
|
||||||
|
.ForMember(
|
||||||
|
vm => vm.ArmorClassBase,
|
||||||
|
conf => conf.MapFrom(armor => armor.Armor.ArmorClassBase.ToString()))
|
||||||
|
.ForMember(vm => vm.HaveDexterityBonus, conf => conf.MapFrom(armor => armor.Armor.HaveDexterityBonus))
|
||||||
|
.ForMember(vm => vm.MinimumStrength, conf => conf.MapFrom(armor => armor.Armor.MinimumStrength))
|
||||||
|
.ForMember(
|
||||||
|
vm => vm.HaveStealthDisadvantage,
|
||||||
|
conf => conf.MapFrom(armor => armor.Armor.HaveStealthDisadvantage))
|
||||||
|
.ForMember(vm => vm.Weight, conf => conf.MapFrom(armor => armor.Armor.Weight))
|
||||||
|
.ForMember(vm => vm.Cost, conf => conf.MapFrom(armor => armor.Armor.Cost))
|
||||||
|
.ForMember(vm => vm.CurrencyType, conf => conf.MapFrom(armor => armor.Armor.CurrencyType)).ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
using AutoMapper;
|
||||||
|
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.CharacterOtherEquipmentViewModels;
|
||||||
|
|
||||||
|
public class CharacterOtherEquipmentsProfile : Profile
|
||||||
|
{
|
||||||
|
public CharacterOtherEquipmentsProfile()
|
||||||
|
{
|
||||||
|
CreateMap<CharacterOtherEquipmentViewModel, CharacterOtherEquipment>().ReverseMap();
|
||||||
|
|
||||||
|
CreateMap<CharacterOtherEquipment, CharacterOtherEquipmentWithDetailsViewModel>()
|
||||||
|
.ForMember(vm => vm.Name, conf => conf.MapFrom(otherEquipment => otherEquipment.OtherEquipment.Name.ToString()))
|
||||||
|
.ForMember(
|
||||||
|
vm => vm.Description,
|
||||||
|
conf => conf.MapFrom(otherEquipment => otherEquipment.OtherEquipment.Description.ToString()))
|
||||||
|
.ForMember(
|
||||||
|
vm => vm.Cost,
|
||||||
|
conf => conf.MapFrom(otherEquipment => otherEquipment.OtherEquipment.Cost))
|
||||||
|
.ForMember(
|
||||||
|
vm => vm.CurrencyType,
|
||||||
|
conf => conf.MapFrom(otherEquipment => otherEquipment.OtherEquipment.CurrencyType)).ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.CharacterWeaponViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class CharacterWeaponsProfile : Profile
|
||||||
|
{
|
||||||
|
public CharacterWeaponsProfile()
|
||||||
|
{
|
||||||
|
CreateMap<CharacterWeaponViewModel, CharacterWeapon>().ReverseMap();
|
||||||
|
|
||||||
|
CreateMap<CharacterWeapon, CharacterWeaponWithWeaponDetailsViewModel>()
|
||||||
|
.ForMember(vm => vm.Name, conf => conf.MapFrom(weapon => weapon.Weapon.Name.ToString()))
|
||||||
|
.ForMember(vm => vm.Weight, conf => conf.MapFrom(weapon => weapon.Weapon.Weight.ToString()))
|
||||||
|
.ForMember(vm => vm.HoldInRightHand, conf => conf.MapFrom(weapon => weapon.HoldInRightHand))
|
||||||
|
.ForMember(vm => vm.HoldInLeftHand, conf => conf.MapFrom(weapon => weapon.HoldInLeftHand))
|
||||||
|
.ForMember(vm => vm.Cost, conf => conf.MapFrom(weapon => weapon.Weapon.Cost.ToString()))
|
||||||
|
.ForMember(vm => vm.RangeMeele, conf => conf.MapFrom(weapon => weapon.Weapon.RangeMeele))
|
||||||
|
.ForMember(vm => vm.RangeLong, conf => conf.MapFrom(weapon => weapon.Weapon.RangeLong))
|
||||||
|
.ForMember(vm => vm.RangeThrowNormal, conf => conf.MapFrom(weapon => weapon.Weapon.RangeThrowNormal))
|
||||||
|
.ForMember(vm => vm.RangeThrowLong, conf => conf.MapFrom(weapon => weapon.Weapon.RangeThrowLong))
|
||||||
|
.ForMember(vm => vm.CurrencyType, conf => conf.MapFrom(weapon => weapon.Weapon.CurrencyType.ToString()))
|
||||||
|
.ForMember(vm => vm.WeaponType, conf => conf.MapFrom(weapon => weapon.Weapon.WeaponType.ToString()))
|
||||||
|
.ForMember(vm => vm.Description, conf => conf.MapFrom(weapon => weapon.Weapon.Description))
|
||||||
|
.ForMember(vm => vm.DiceValue, conf => conf.MapFrom(weapon => weapon.Weapon.DiceValue))
|
||||||
|
.ForMember(vm => vm.DiceCount, conf => conf.MapFrom(weapon => weapon.Weapon.DiceCount))
|
||||||
|
.ForMember(vm => vm.TwoHandDiceValue, conf => conf.MapFrom(weapon => weapon.Weapon.TwoHandDiceValue))
|
||||||
|
.ForMember(vm => vm.TwoHandDamageType, conf => conf.MapFrom(weapon => weapon.Weapon.TwoHandDamageType.ToString())).ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.OtherEquipmentViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class OtherEquipmentProfile : Profile
|
||||||
|
{
|
||||||
|
public OtherEquipmentProfile()
|
||||||
|
{
|
||||||
|
CreateMap<OtherEquipmentViewModel, OtherEquipment>().ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.ViewModels.WeaponViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Profiles
|
||||||
|
{
|
||||||
|
public class WeaponProfile : Profile
|
||||||
|
{
|
||||||
|
public WeaponProfile()
|
||||||
|
{
|
||||||
|
CreateMap<WeaponViewModel, Weapon>().ReverseMap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
using AutoMapper;
|
||||||
|
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.ArmorViewModels;
|
||||||
|
|
||||||
|
public class ArmorService : ServiceBase<ArmorViewModel, Armor>, IArmorService
|
||||||
|
{
|
||||||
|
public ArmorService(IMapper mapper, IRepository<Armor> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
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.CharacterArmorViewModels;
|
||||||
|
|
||||||
|
public class CharacterArmorService : ServiceBase<CharacterArmorViewModel, CharacterArmor>, ICharacterArmorService
|
||||||
|
{
|
||||||
|
public CharacterArmorService(IMapper mapper, IRepository<CharacterArmor> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
|
||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.CharacterOtherEquipmentViewModels;
|
||||||
|
|
||||||
|
public class CharacterOtherEquipmentService : ServiceBase<CharacterOtherEquipmentViewModel, CharacterOtherEquipment>, ICharacterOtherEquipmentService
|
||||||
|
{
|
||||||
|
public CharacterOtherEquipmentService(IMapper mapper, IRepository<CharacterOtherEquipment> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.CharacterWeaponViewModels;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class CharacterWeaponService : ServiceBase<CharacterWeaponViewModel, CharacterWeapon>, ICharacterWeaponService
|
||||||
|
{
|
||||||
|
public CharacterWeaponService(IMapper mapper, IRepository<CharacterWeapon> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
using AutoMapper;
|
||||||
|
|
||||||
|
using SessionCompanion.Database.Repositories.Base;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using SessionCompanion.Services.Base;
|
||||||
|
using SessionCompanion.Services.Interfaces;
|
||||||
|
using SessionCompanion.ViewModels.OtherEquipmentViewModels;
|
||||||
|
|
||||||
|
public class OtherEquipmentService : ServiceBase<OtherEquipmentViewModel, OtherEquipment>, IOtherEquipmentService
|
||||||
|
{
|
||||||
|
public OtherEquipmentService(IMapper mapper, IRepository<OtherEquipment> 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.WeaponViewModels;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Services.Services
|
||||||
|
{
|
||||||
|
public class WeaponService : ServiceBase<WeaponViewModel, Weapon>, IWeaponService
|
||||||
|
{
|
||||||
|
public WeaponService(IMapper mapper, IRepository<Weapon> repository) : base(mapper, repository)
|
||||||
|
{ }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.ArmorViewModels
|
||||||
|
{
|
||||||
|
using SessionCompanion.ViewModels.Enums;
|
||||||
|
|
||||||
|
public class ArmorViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Category { get; set; }
|
||||||
|
public string ArmorClassBase { get; set; }
|
||||||
|
public bool HaveDexterityBonus { get; set; }
|
||||||
|
public int? MinimumStrength { get; set; }
|
||||||
|
public bool HaveStealthDisadvantage { get; set; }
|
||||||
|
public int Weight { get; set; }
|
||||||
|
public int Cost { get; set; }
|
||||||
|
public CurrencyType CurrencyType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.CharacterArmorViewModels
|
||||||
|
{
|
||||||
|
public class CharacterArmorViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public int ArmorId { get; set; }
|
||||||
|
public bool InUse { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
using SessionCompanion.ViewModels.Enums;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.CharacterArmorViewModels
|
||||||
|
{
|
||||||
|
public class CharacterArmorViewModelDetails
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public int ArmorId { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Category { get; set; }
|
||||||
|
public string ArmorClassBase { get; set; }
|
||||||
|
public bool HaveDexterityBonus { get; set; }
|
||||||
|
public int? MinimumStrength { get; set; }
|
||||||
|
public bool HaveStealthDisadvantage { get; set; }
|
||||||
|
public int Weight { get; set; }
|
||||||
|
public int Cost { get; set; }
|
||||||
|
public CurrencyType CurrencyType { get; set; }
|
||||||
|
public bool InUse { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.CharacterOtherEquipmentViewModels
|
||||||
|
{
|
||||||
|
public class CharacterOtherEquipmentViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public int OtherEquipmentId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
using SessionCompanion.ViewModels.Enums;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.CharacterOtherEquipmentViewModels
|
||||||
|
{
|
||||||
|
public class CharacterOtherEquipmentWithDetailsViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public int OtherEquipmentId { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public int Cost { get; set; }
|
||||||
|
public CurrencyType CurrencyType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.CharacterWeaponViewModels
|
||||||
|
{
|
||||||
|
public class CharacterWeaponViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public int CharacterId { get; set; }
|
||||||
|
public int WeaponId { get; set; }
|
||||||
|
public bool InUse { get; set; }
|
||||||
|
public bool HoldInRightHand { get; set; }
|
||||||
|
public bool HoldInLeftHand { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
using SessionCompanion.ViewModels.Enums;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.CharacterWeaponViewModels
|
||||||
|
{
|
||||||
|
public class CharacterWeaponWithWeaponDetailsViewModel
|
||||||
|
{
|
||||||
|
public int WeaponId { get; set; }
|
||||||
|
public bool InUse { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public int Cost { get; set; }
|
||||||
|
public CurrencyType CurrencyType { get; set; }
|
||||||
|
public int Weight { get; set; }
|
||||||
|
public bool HoldInRightHand { get; set; }
|
||||||
|
public bool HoldInLeftHand { get; set; }
|
||||||
|
public int DiceCount { get; set; }
|
||||||
|
public int DiceValue { get; set; }
|
||||||
|
public int? TwoHandDiceCount { get; set; }
|
||||||
|
public int? TwoHandDiceValue { get; set; }
|
||||||
|
public string TwoHandDamageType { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public string WeaponType { get; set; }
|
||||||
|
public int RangeMeele { get; set; }
|
||||||
|
public int? RangeThrowNormal { get; set; }
|
||||||
|
public int? RangeThrowLong { get; set; }
|
||||||
|
public int? RangeLong { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.Enums
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rodzaje waluty
|
||||||
|
/// </summary>
|
||||||
|
public enum CurrencyType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Bronz
|
||||||
|
/// </summary>
|
||||||
|
cp,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Srebro
|
||||||
|
/// </summary>
|
||||||
|
sp,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Elektrum
|
||||||
|
/// </summary>
|
||||||
|
ep,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Złotot
|
||||||
|
/// </summary>
|
||||||
|
gp,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Platyna
|
||||||
|
/// </summary>
|
||||||
|
pp
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
namespace SessionCompanion.ViewModels.OtherEquipmentViewModels
|
||||||
|
{
|
||||||
|
using SessionCompanion.ViewModels.Enums;
|
||||||
|
|
||||||
|
public class OtherEquipmentViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public int Cost { get; set; }
|
||||||
|
public CurrencyType CurrencyType { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -310,6 +310,36 @@
|
|||||||
Czy postać posiada biegłość w skradaniu się
|
Czy postać posiada biegłość w skradaniu się
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:SessionCompanion.ViewModels.Enums.CurrencyType">
|
||||||
|
<summary>
|
||||||
|
Rodzaje waluty
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:SessionCompanion.ViewModels.Enums.CurrencyType.cp">
|
||||||
|
<summary>
|
||||||
|
Bronz
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:SessionCompanion.ViewModels.Enums.CurrencyType.sp">
|
||||||
|
<summary>
|
||||||
|
Srebro
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:SessionCompanion.ViewModels.Enums.CurrencyType.ep">
|
||||||
|
<summary>
|
||||||
|
Elektrum
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:SessionCompanion.ViewModels.Enums.CurrencyType.gp">
|
||||||
|
<summary>
|
||||||
|
Złotot
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="F:SessionCompanion.ViewModels.Enums.CurrencyType.pp">
|
||||||
|
<summary>
|
||||||
|
Platyna
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:SessionCompanion.ViewModels.IntelligenceViewModels.IntelligenceViewModel.Id">
|
<member name="P:SessionCompanion.ViewModels.IntelligenceViewModels.IntelligenceViewModel.Id">
|
||||||
<summary>
|
<summary>
|
||||||
Identyfikator inteligencji postaci
|
Identyfikator inteligencji postaci
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
using SessionCompanion.ViewModels.Enums;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace SessionCompanion.ViewModels.WeaponViewModels
|
||||||
|
{
|
||||||
|
public class WeaponViewModel
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public int Cost { get; set; }
|
||||||
|
public int Weight { get; set; }
|
||||||
|
|
||||||
|
public CurrencyType CurrencyType { get; set; }
|
||||||
|
public int DiceCount { get; set; }
|
||||||
|
public int DiceValue { get; set; }
|
||||||
|
|
||||||
|
public int? TwoHandDiceCount { get; set; }
|
||||||
|
public int? TwoHandDiceValue { get; set; }
|
||||||
|
public string TwoHandDamageType { get; set; }
|
||||||
|
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
public string WeaponType { get; set; }
|
||||||
|
public int RangeMeele { get; set; }
|
||||||
|
public int? RangeThrowNormal { get; set; }
|
||||||
|
public int? RangeThrowLong { get; set; }
|
||||||
|
public int? RangeLong { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -27,6 +27,12 @@ namespace SessionCompanion.Configurations
|
|||||||
services.AddScoped<IRepository<Strength>, StrengthRepository>();
|
services.AddScoped<IRepository<Strength>, StrengthRepository>();
|
||||||
services.AddScoped<IRepository<User>, UserRepository>();
|
services.AddScoped<IRepository<User>, UserRepository>();
|
||||||
services.AddScoped<IRepository<Wisdom>, WisdomRepository>();
|
services.AddScoped<IRepository<Wisdom>, WisdomRepository>();
|
||||||
|
services.AddScoped<IRepository<Armor>, ArmorRepository>();
|
||||||
|
services.AddScoped<IRepository<CharacterArmor>, CharacterArmorRepository>();
|
||||||
|
services.AddScoped<IRepository<OtherEquipment>, OtherEquipmentRepository>();
|
||||||
|
services.AddScoped<IRepository<CharacterOtherEquipment>, CharacterOtherEquipmentRepository>();
|
||||||
|
services.AddScoped<IRepository<Weapon>, WeaponRepository>();
|
||||||
|
services.AddScoped<IRepository<CharacterWeapon>, CharacterWeaponRepository>();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,13 @@ namespace SessionCompanion.Configurations
|
|||||||
services.AddScoped<IStrengthService, StrengthService>();
|
services.AddScoped<IStrengthService, StrengthService>();
|
||||||
services.AddScoped<IUserService, UserService>();
|
services.AddScoped<IUserService, UserService>();
|
||||||
services.AddScoped<IWisdomService, WisdomService>();
|
services.AddScoped<IWisdomService, WisdomService>();
|
||||||
|
services.AddScoped<IArmorService, ArmorService>();
|
||||||
|
services.AddScoped<ICharacterArmorService, CharacterArmorService>();
|
||||||
|
services.AddScoped<IOtherEquipmentService, OtherEquipmentService>();
|
||||||
|
services.AddScoped<ICharacterOtherEquipmentService, CharacterOtherEquipmentService>();
|
||||||
|
services.AddScoped<IWeaponService, WeaponService>();
|
||||||
|
services.AddScoped<ICharacterWeaponService, CharacterWeaponService>();
|
||||||
|
|
||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user