SES-148 Endpointy dla Armor i Weapon #71
@ -36,9 +36,12 @@ namespace SessionCompanion.Services.Services
|
|||||||
public async Task<Either<SuccessResponse,ErrorResponse>> ChangeCharacterWeapon(CharacterWeaponViewModel model)
|
public async Task<Either<SuccessResponse,ErrorResponse>> ChangeCharacterWeapon(CharacterWeaponViewModel model)
|
||||||
{
|
{
|
||||||
// Dodaj optional rozbro postac
|
// 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();
|
||||||
s426135 marked this conversation as resolved
s426134
commented
to chyba juz można wywalić :P to chyba juz można wywalić :P
|
|||||||
|
var weaponsInUse = allWeapons.Where(w => w.InUse.Equals(true)).ToList();
|
||||||
|
|
||||||
var weapon = Mapper.Map<CharacterWeapon>(model);
|
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)
|
if (weaponsInUse.Count() == 0)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user
można to wszystko skrócić dodając lub, czyli c.CharacterId.Equals(model.CharacterId) && ( jestWLewej || jestWPrawej || jest równa weapon id z modelu )
Neh, tego potrzeba tak jak jest, musze miec wszystkie bronie jakie są, aby mieć dostęp do Id