SES-148 Endpointy dla Armor i Weapon #71
@ -41,7 +41,7 @@ namespace SessionCompanion.Services.Services
|
||||
}
|
||||
|
||||
if (armorToUse is null)
|
||||
return new ErrorResponse() { StatusCode = 204, Message = "No weapon to change to" };
|
||||
return new ErrorResponse() { StatusCode = 204, Message = "No armor to change to" };
|
||||
|
||||
if (armorInUse is null)
|
||||
{
|
||||
@ -50,7 +50,7 @@ namespace SessionCompanion.Services.Services
|
||||
{
|
||||
await Repository.Update(armorToUse);
|
||||
await Repository.Save();
|
||||
return new SuccessResponse("Character weapon updated") { SuccessCode = 200 };
|
||||
return new SuccessResponse("Character armor updated") { SuccessCode = 200 };
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -65,7 +65,7 @@ namespace SessionCompanion.Services.Services
|
||||
await Repository.Update(armorInUse);
|
||||
await Repository.Update(armorToUse);
|
||||
await Repository.Save();
|
||||
return new SuccessResponse("Character weapon updated") { SuccessCode = 204 };
|
||||
return new SuccessResponse("Character armor updated") { SuccessCode = 204 };
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -37,7 +37,6 @@ namespace SessionCompanion.Services.Services
|
||||
{
|
||||
// Dodaj optional rozbro postac
|
||||
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();
|
||||
s426135 marked this conversation as resolved
s426134
commented
to chyba juz można wywalić :P to chyba juz można wywalić :P
|
||||
|
||||
var weapon = Mapper.Map<CharacterWeapon>(model);
|
||||
|
@ -66,11 +66,11 @@ namespace SessionCompanion.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metoda zmienia uzywany armor danej postaci
|
||||
/// Metoda zmienia uzywaną zbroję danej postaci na taki jaki jest wybrany
|
||||
/// </summary>
|
||||
/// <param name="characterId"></param>
|
||||
/// <param name="newArmorId"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="characterId"> Id postaci </param>
|
||||
/// <param name="newArmorId"> Id nowej zbroi </param>
|
||||
/// <returns>SuccessResponse/ErrorResponse</returns>
|
||||
[HttpPut("changeArmor")]
|
||||
public async Task<Either<SuccessResponse, ErrorResponse>> ChangeCharacterArmor(int characterId, int newArmorId)
|
||||
{
|
||||
@ -79,10 +79,10 @@ namespace SessionCompanion.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metoda dodaje Armor do danej postaci
|
||||
/// Metoda dodaje nową zbroje do danej postaci
|
||||
/// </summary>
|
||||
/// <param name="characterArmorViewModel"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="characterArmorViewModel"> View model z odpowiednimi parameterami </param>
|
||||
/// <returns>SuccessResponse/ErrorResponse</returns>
|
||||
[HttpPut("addArmor")]
|
||||
public async Task<Either<SuccessResponse, ErrorResponse>> AddCharacterArmor(CharacterArmorViewModel characterArmorViewModel)
|
||||
{
|
||||
@ -101,10 +101,10 @@ namespace SessionCompanion.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metoda dodaje Weapon do danej postaci
|
||||
/// Metoda dodaje broń do danej postaci
|
||||
/// </summary>
|
||||
/// <param name="characterWeaponViewModel"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="characterWeaponViewModel"> View model z odpowiednimi parameterami </param>
|
||||
/// <returns>SuccessResponse/ErrorResponse</returns>
|
||||
[HttpPut("addWeapon")]
|
||||
public async Task<Either<SuccessResponse, ErrorResponse>> AddCharacterWeapon(CharacterWeaponViewModel characterWeaponViewModel)
|
||||
{
|
||||
|
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