SES-148 CharacterWeaponViewModel doesnt need valid ID anymore
This commit is contained in:
parent
71f01a167c
commit
ad92ad468b
@ -36,9 +36,12 @@ namespace SessionCompanion.Services.Services
|
||||
public async Task<Either<SuccessResponse,ErrorResponse>> ChangeCharacterWeapon(CharacterWeaponViewModel model)
|
||||
{
|
||||
// Dodaj optional rozbro postac
|
||||
var weaponsInUse = await Repository.Get(c => c.CharacterId.Equals(model.CharacterId)).Where(w => w.InUse.Equals(true)).ToListAsync();
|
||||
|
||||
var allWeapons = await Repository.Get(c => c.CharacterId.Equals(model.CharacterId)).AsNoTracking().ToListAsync();
|
||||
//var weaponsInUse = await Repository.Get(c => c.CharacterId.Equals(model.CharacterId)).Where(w => w.InUse.Equals(true)).ToListAsync();
|
||||
var weaponsInUse = allWeapons.Where(w => w.InUse.Equals(true)).ToList();
|
||||
|
||||
var weapon = Mapper.Map<CharacterWeapon>(model);
|
||||
weapon.Id = allWeapons.Where(w => w.WeaponId.Equals(model.WeaponId)).Select(x => x.Id).FirstOrDefault();
|
||||
|
||||
if (weaponsInUse.Count() == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user